which of the open source Java graph drawing frameworks to use for a network diagram with the following requirements? The graph will have less than 1000 nodes.
1) has par
I like @holygeek's answer. Here is my implementation to the solution for 2 (both directed and undirected edges), for Prefuse:
public class MyRenderFactory implements RendererFactory
{
private NodeRenderer nodeRenderer = new NodeRenderer();
private EdgeRenderer defaultEdgeRenderer = new EdgeRenderer();
private EdgeRenderer undirectedEdgeRenderer = new EdgeRenderer(EdgeRenderer.EdgeType.LINE, EdgeRenderer.EdgeArrowType.NONE);
public static String directedness = "myEdgeDirectedness";
public enum EdgeDirected
{
directed, undirected;
public static EdgeDirected fromIsDirected(boolean isDirected)
{
if (isDirected)
{
return directed;
}
return undirected;
}
}
@Override
public Renderer getRenderer(VisualItem> visualItem)
{
if (visualItem instanceof EdgeItem)
{
if (visualItem.get(directedness).equals(PrefuseGraphConverter.EdgeDirected.undirected))
{
return undirectedEdgeRenderer;
}
return defaultEdgeRenderer;
}
return nodeRenderer;
}
}
...elsewhere, where the graph is created...
MyRenderFactory.EdgeDirected directedness =
MyRenderFactory.EdgeDirected.fromIsDirected(myEdge.isDirected());
prefuseEdge.set(MyRenderFactory.directedness, directedness);