I am trying to build a force directed graph in JUNG, similar to the ones you can create (very easily) in D3.js.
Most of it is very simple but the docs are a bit old and the examples dont include a force directed one (although there is a java applet on there that claims to be a demo but it shows nothing)
Anyway, using a DirectedSparseGraph
I have achieve most of the functionality:
directedGraph = new DirectedSparseGraph();
directedGraph.addVertex("someVertex");
directedGraph.addVertex("someOtherVertex");
// etc
directedGraph.addEdge("someVertex", "someOtherVertex");
// etc
This gives me almost exactly what I want but I can't figure out how to assign a length to the edges to show differing forces. I've looked through the docs and Google but can't find anything.
I'd expect something like
directedGraph.addEdge([edge 1], [edge 2], [edge length]);
but it doesn't seem to exist in the api.
Anyone have any idea how to achieve this?
N.b. jung version is 2.0.1