use of au.gov.asd.tac.constellation.plugins.algorithms.clustering.infomap.infomap.InfomapBase in project constellation by constellation-app.
the class InfoMapMainNGTest method runInfoMap.
private static void runInfoMap(final Config config, final GraphReadMethods rg) throws FileNotFoundException {
final InfoMapContext context = new InfoMapContext(config, rg);
context.getInfoMap().run();
final InfomapBase infomap = context.getInfoMap();
final TreeData treeData = infomap.getTreeData();
System.out.printf("*Vertices %d\n", treeData.getNumLeafNodes());
for (final NodeBase node : treeData.getLeaves()) {
final int index = node.getParent().getIndex();
System.out.printf("position=%d vxId=%d cluster=%d\n", node.getOriginalIndex(), rg.getVertex(node.getOriginalIndex()), index + 1);
}
}
use of au.gov.asd.tac.constellation.plugins.algorithms.clustering.infomap.infomap.InfomapBase in project constellation by constellation-app.
the class InfoMapPlugin method edit.
@Override
protected void edit(final GraphWriteMethods wg, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
if (wg.getVertexCount() <= 0) {
interaction.notify(PluginNotificationLevel.ERROR, "The graph must have at least one vertex to run clustering on");
LOGGER.log(Level.WARNING, "{0} run on Empty Graph", Bundle.InfoMapPlugin());
return;
}
final Config config = (Config) parameters.getParameters().get(CONFIG_PARAMETER_ID).getObjectValue();
final InfoMapContext context = new InfoMapContext(config, wg);
context.getInfoMap().run();
final int clusterAttrId = ClusteringConcept.VertexAttribute.INFOMAP_CLUSTER.ensure(wg);
final InfomapBase infomap = context.getInfoMap();
final TreeData treeData = infomap.getTreeData();
LOGGER.log(Level.INFO, "Vertices {0}", treeData.getNumLeafNodes());
for (final NodeBase node : treeData.getLeaves()) {
final int index = node.getParent().getIndex();
wg.setIntValue(clusterAttrId, wg.getVertex(node.getOriginalIndex()), index + 1);
}
}
Aggregations