Wiki

Clone wiki

JGraphT-Gephi / Home

warning: alpha version

This library allows for a more UI-independent manipulation/generation of graph's in Gephi. This is accomplished by 'wrapping' components of Gephi's graph into the JGraphT graph by using generics. In short, this is accomplished in a following manner:

org.jgrapht.Graph<Node, Edge> jGraph = new DefaultDirectedWeightedGraph<org.gephi.graph.api.Node, org.gephi.graph.api.Edge>(Edge.class);

This allows you to have a JGraphT graph with the Gephi's nodes and edges. Having a JGraphT graph allows for an algorithmic centered manipulation of graphs and overcomes some of the ui-centered limitations of Gephi as described bellow.

Motivation: Limitations of Gephi due to it's UI orientation

Gephi is currently by far the best library for visualizing and interacting with graphs. However since Gephi is oriented towards UI aspects, it’s graph implementation has quite a heavy overhead geared towards optimizing the performance of UI. Likewise the architecture is centered towards UI aspects e.g. only one graphModel per workspace, etc.

P.S. This by no means is meant as a criticism of Gephi; since Gephi's design decisions are indeed very appropriate for the UI orientation; implementation geared towards algorithms has a different set of needs that often conflict with the UI needs. Trying to provide a unified implementation that works for both ui and algorithmic aspects might be quite time consuming, and may result in overly complicated architecture. Hopefully this library provides a quick and dirty workaround.

Heavy (memory-wise) implementation of Graph

Gephi's graph implementation has quite a heavy memory overhead geared towards optimizing the performance of UI. When it is necessary to generate a large number of graphs, this results in out of memory error; partially due to the heavy overhead and also due to the delayed garbage collection (as discussed in more detail here).

Verbose UI oriented syntax

Creating a graph requires creating a UI infrastructure:

        //Init a project - and therefore a workspace
        ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
        pc.newProject();
        Workspace workspace = pc.getCurrentWorkspace();

        //Get controllers and models
        ImportController importController = Lookup.getDefault().lookup(ImportController.class);
        GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();

        //Import file
        Container container = importController.importFile(file);

        //Append imported data to GraphAPI
        importController.process(container, new DefaultProcessor(), workspace);

Issues

This library is in a very early stage (alpha); hence there are quite a few issues that you should be aware of.

References

http://activeintelligence.org/blog/archive/graph-algorithms-libraries-for-java/

https://github.com/gephi/gephi/issues/526

https://forum.gephi.org/viewtopic.php?f=27&t=1639

Updated