Toolkit - Statistics and Metrics
From Gephi:Wiki
This Toolkit Example is part of the toolkit-demos project, that can be download from the website.
Demo
How to execute a metric algorithm and get the result for each node. The algorithm write values in a column it creates. It is also possible to get the statistics report, as in Gephi. See the list of implemented metrics.
//Get graph model and attribute model of current workspace GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel(); AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel(); //Get Centrality GraphDistance distance = new GraphDistance(); distance.setDirected(true); distance.execute(graphModel, attributeModel); //Get Centrality column created AttributeColumn col = attributeModel.getNodeTable().getColumn(GraphDistance.BETWEENNESS); //Iterate over values for (Node n : graph.getNodes()) { Double centrality = (Double)n.getNodeData().getAttributes().getValue(col.getIndex()); }

