use of au.gov.asd.tac.constellation.plugins.algorithms.clustering.infomap.traits.FlowBase in project constellation by constellation-app.
the class InfomapGreedy method calcCodelengthFromFlowWithinOrExit.
@Override
protected double calcCodelengthFromFlowWithinOrExit(final NodeBase parent) {
final FlowBase parentData = getNode(parent).getData();
final double parentFlow = parentData.getFlow();
final double parentExit = parentData.getExitFlow();
final double totalParentFlow = parentFlow + parentExit;
if (totalParentFlow < 1e-16) {
return 0;
}
double indexLength = 0;
// For each child...
for (final NodeBase node : parent.getChildren()) {
indexLength -= plogp(getNode(node).getData().getFlow() / totalParentFlow);
}
indexLength -= plogp(parentExit / totalParentFlow);
indexLength *= totalParentFlow;
return indexLength;
}