use of au.gov.asd.tac.constellation.plugins.algorithms.clustering.infomap.util.MultiMap in project constellation by constellation-app.
the class InfomapGreedy method sortTree.
@Override
protected void sortTree(final NodeBase parent) {
if (parent.getSubInfomap() != null) {
parent.getSubInfomap().sortTree();
}
final MultiMap<Double, NodeBase> sortedModules = new MultiMap<>((d1, d2) -> (int) Math.signum(d2 - d1));
if (DEBUG && parent.getChildDegree() > 0) {
for (final NodeBase child : parent.getChildren()) {
LOGGER.log(Level.INFO, "{0}", child.getId());
}
}
for (final NodeBase child : parent.getChildren()) {
sortTree(child);
final double rank = getNode(child).getData().getFlow();
sortedModules.put(rank, child);
}
parent.releaseChildren();
int sortedIndex = 0;
for (final Map.Entry<Double, NodeBase> entry : sortedModules.entrySet()) {
parent.addChild(entry.getValue());
entry.getValue().setIndex(sortedIndex);
sortedIndex++;
}
}