A generic and highly-extensible graph visualization library whose basic interface is a widget analogous to java.swing.JTree.
The diva.graph collection of packages provides three central pieces of functionality:
- A widget which uses the structured drawing library diva.canvas to provide an extensible framework for
graph editing and has a simple interface. By using diva.canvas, it is easy to add your own interactors (e.g.
XXX, YYY, etc.) in addition to or in place of the standard set (selection, resize, drag-and-drop, rename, etc.).
- A graph data structure interface and default implementation (package diva.graph.model). The data structure
is architected to support model-view-controller (MVC), so it can be viewed by multiple parties. It can be used
as an intermediary means of communicating a graph structure between an application and the visualization system,
or can be easily back-ended by a pre-existing graph package.
- A generic interface to graph layout algorithms and a set of default implementations (package diva.graph.layout),
which again can be extended or replaced. The most powerful instances of this interface are currently implemented
by a set of commercial tools which we are unable to release, but we provide some basic techniques in their place,
and hope to grow this part of the library over time.
For a taste of how this library works in its most basic form, the following piece of code instantiates a basic
graph, containing two nodes connected by an edge ( A -> B ).
// Construct the widgets
Frame f = new Frame();
JGraph g = new JGraph();
f.add("Center", g);
// Construct the graph
BasicNode a = new BasicNode("a");
BasicNode b = new BasicNode("b");
BasicEdge e = new BasicEdge("e");
jg.getModel().addNode(a);
jg.getModel().addNode(b);
jg.getModel().connect(e, a, b);
// Display it all
f.setVisible(true);
@since Ptolemy II 1.0