-
Notifications
You must be signed in to change notification settings - Fork 1.6k
How to compute a metric
sheymann edited this page Jan 4, 2015
·
1 revision
This Toolkit Example is part of the toolkit-demos project, that can be downloaded from the website.
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());
}
- Developer Handbook
- Build
- Code Style
- Localization
- Datasets
- Import CSV Data
- Import Dynamic Data
- Scripting Plugin
- Quick Start
- Démarrage rapide (FR)
- Layout
- Spatialisations (FR)
- Statistics
- Import
- Spigot importer with Wizard
- Export
- Generator
- Filter
- Extend Data Laboratory
- Preview renderer
- Add a module panel
- Add a submenu
- Build a plugin without Gephi source code
- Update a plugin
- Code Sharing Strategy
- Graph Streaming