There are! Although almost any *good* implementation of such an algorithm is provided by commercial products (automatic graph layout is an active research area). AFAIK almost all of them allow you to use your own view component (JGraph in your case). Try the following Webstart program and have a look at the different layout algorithms which are available from the layout menu:
Free Java Graph Editor "yEd" (Webstart)
http://www.yworks.com/products/yed/demo/yed.jnlp
If you don't have Webstart installed on your machine take a look at the gallery:
http://www.yworks.com/en/products_yfiles_practicalinfo_gallery.htm
or a tiny userguide concerning some of the major layout styles:
http://www.yworks.com/products/yfiles/doc/userguide/layout/major.html
Using the API
(http://www.yworks.com/products/yfiles/doc/api-gif/index.html)
it is easy to automatically layout graphs for any kind of view, if you don't want to use yFiles' (that's the product's name) viewer component.
For some other (mostly unaffordable :D ) automatic layout algorithms google for "java graph layout".
Regards, Sebastian Mueller
Hi,
I am right now working on struts technology.I have created screens to add,retrieve data from the database.My requirement is i need to create the tree in struts.when i click on a menu the tree should be displayed.since you have already done some work on developing tree can you help me?
Hi Sebastian,
I have to do auto routing of connections into our graphical editor.
I have tried to use the OrthogonalEdgeRouter for that purpose with the following way:
OrthogonalEdgeRouter orthogonalEdgeRouter = new OrthogonalEdgeRouter();
orthogonalEdgeRouter.setSphereOfAction(OrthogonalEdgeRouter.ROUTE_ALL_EDGES);
orthogonalEdgeRouter.setMinimumDistanceToNode(10);
orthogonalEdgeRouter.setCoupledDistances(true);
orthogonalEdgeRouter.setMinimumDistance(5);
orthogonalEdgeRouter.setGridSpacing(2);
orthogonalEdgeRouter.setCenterToSpaceRatio(0.5);
orthogonalEdgeRouter.setGridRoutingEnabled(true);
orthogonalEdgeRouter.setReroutingEnabled(true);
orthogonalEdgeRouter.setCrossingCost(2.0);
orthogonalEdgeRouter.setLocalCrossingMinimizationEnabled(true);
BufferedLayouter bufferedLayouter = new BufferedLayouter(orthogonalEdgeRouter);
bufferedLayouter.doLayout(graph);
Unfortunately this code does not layout the connections into our diagram in orthogonal way, but changed the connections to direct connections(straight lines) between nodes.
I changed a lot of upper mentioned method invocations, but without success.
BTW: version of yFiles is 2.0.0.7
Do you have any ideas where I am wrong?
Thanks in advance,
Aleksandar