JGoLayeredDigraphAutoLayout.initializeCol

Hi,

I’m trying to override the initializeColumns method of JGoLayeredDigraphAutoLayout in order to influence the layout of a version tree. The goal is to place the nodes with the same branch tag in the same column.

In initializeColumns I did the following:

  1. Find the start node, which is the one that doesn’t have a predecessor.
  2. Follow the links from there throughout the graph.
  3. Assign column numbers starting from 0 and incrementing as new branch tags are encountered.
  4. Assign the resulting columns numbers to the “column” field of the attached JGoLayeredDigraphAutoLayoutNodeData.
  5. Any JGoNetworkNode that is not associated with with a JGoNode I added in the JGoDocument is not initialized.

The method is called, but it hasn’t got the slightest impact on the resulting layout.

Regards,

Werner.

It sounds like you’re doing the right thing. It’s possible that you are seeing reordering that is changing the relative column numbers for your nodes. We’ll investigate; I thought we had a simple test of this somewhere.

Wait – are you trying to specify particular column positions for the final results? The initializeColumns method is just for specifying initial values, where the columns are effectively relative to each other. The final column assignments are likely not to have to do anything with the initial ones.

Indeed, that is the problem. Thank you again Walter.

In the meantime I have changed the solution. The branches are now in invisible subgraphs with their own auto-layout. The main graph is then laid out horizontally from left to right. This actually results in a much more compact layout than I would have had with my original plan. It looks quite good now.

Werner.