I'm just newbie to Gephi and I like it. When I used the toolkit is seems to me the code is too complicated (compared to other libraries I've used in the past 10 years).
I believe wrapper classes will make things much easier to the users (and third party developers).
For instance this is the toolkit code for getting different measures:
Code: Select all
ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
pc.newProject();
Workspace workspace=pc.getCurrentWorkspace();
ImportController importController=Lookup.getDefault().lookup(ImportController.class);
try{
File file=new File("example.csv");
container=importController.importFile(file);
container.getLoader().setEdgeDefault(EdgeDefault.UNDIRECTED);
container.setAllowAutoNode(false);
}catch(Exception ex)
{
ex.printStackTrace();
return;
}
importController.process(container,new DefaultProcessor(),workspace);
GraphModel graphModel=Lookup.getDefault().lookup(GraphController.class).getModel();
AttributeModel attributeModel=Lookup.getDefault().lookup(AttributeController.class).getModel();
Graph graph = graphModel.getGraph();
GraphDistance distance=new GraphDistance();
distance.setDirected(false);
distance.execute(graphModel, attributeModel);
AttributeColumn col=attributeModel.getNodeTable().getColumn(GraphDistance.BETWEENNESS);
AttributeColumn col2=attributeModel.getNodeTable().getColumn(GraphDistance.CLOSENESS);
for(Node n:graph.getNodes())
{
System.out.println(n.getNodeData().getId()+" betweenness="+
n.getNodeData().getAttributes().getValue(col.getIndex())+
" closeness="+n.getNodeData().getAttributes().getValue(col2.getIndex())+
" degree="+graph.getDegree(n));
}
Here's an example of how things can be with wrapper classes.
Code: Select all
Project project=new Project(PARAMETER.IF.NEEDED);
Container container=new Container(new File("example.csv"));
Measurement centrality=container.getCentrality();
Measurement betweenness=container.getBetweenness();
Measurement closeness=container.getCloseness();
for(Entry entry:centrality)
System.out.println(entry.getName()+ "centrality="+entry.getValue());
For exporting files I actually doing it myself since i'm its too complicated in the toolkit.
Again, its just a suggestion no more no less.
Thanks