Closed shivam529 closed 3 years ago
Here is an example:
Graph<String, Integer> graph = // make your graph
TidierTreeLayoutAlgorithm<String, Integer> layoutAlgorithm =
TidierTreeLayoutAlgorithm.<String, Integer>edgeAwareBuilder().expandLayout(false).build();
LayoutModel<String> layoutModel = LayoutModel.<String>builder().size(100, 100).graph(graph).build();
layoutAlgorithm.visit(layoutModel);
System.out.println("points are "+layoutModel.getLocations());
If you need the edge articulations (where they bend) for a layout like Sugiyama, you can get the articulation points for each edge using the layout's edgeArticulationFunction
If you choose a layout algorithm that is threaded, you will not get your layout points immediately. Either make it not-threaded or wait for it to finish.
You can use the code in the jungrapht-layout jar to apply layout algorithms, then retrieve the Points from the LayoutModel.