Search code examples
javagraphjung

Jung - Initialize only a single vertex in Transformer


I am working on graph layout using KKLayout. I require only the first vertex to be at the top of the layout and others to be in their default locations. There is a similar question to this:

How do I initialize vertex locations in a custom JUNG layout?

The transformer in this case applies to all the vertices. How do I apply only to a particular vertex and let the other vertices handled by the KKLayout?

I have tried the option

layout.setLocation(firstVertex, 500, 0);

and this option does not work.


Solution

  • Call Layout.setLocation() followed by Layout.lock(firstVertex, true).