Retaining hierarchy of graph in cluster

Hi all,

I am currently using the Python API. Above is my current graph.

The black nodes shown below are the original nodes. However, after adding the red nodes as shown below, it resulted in the graph above. In other words, how can I add the red nodes shown in the graph below while retaining the hierarchy in the second cluster by aligning the nodes to the top within the second layer?

Thanks.

It is very difficult to debug/change a program without access to the source.
That said, I will take a wild guess at what you want to do - look at the TBbalance attribute (TBbalance | Graphviz)
If that does not solve your problem, please provide source. If you can’t share proprietary information, we can provide an anonymizer program.

Hi @steveroush,

I have mainly resolved my issue by introducing nested subgraphs within each subgraph cluster for each layer.

However, am now facing this issue instead…

Would like to ask if you have any suggestions to resolve the issue above?

Am currently using Python API with html like labels.
https://graphviz.readthedocs.io/en/stable/api.html

Thank you for the help.

Is this a one-time graph (quick & dirty solution is probably OK) or a run-many-times graph (really want to automate completely?)

p.s. if you want to try creating an anonymous version to share, here is a link to an anonymizer GVPR program (cmd/gvpr/lib/anon · main · graphviz / graphviz · GitLab)
download it, produce a dot format output from your Python program (names myFile.gv) and use this command line gvpr -f anon myFile.gv. Note that you may need to hand-edit the cluster names.
Link to GVPR - part of the Graphviz package -(https://www.graphviz.org/pdf/gvpr.1.pdf)

Just making guesses about the input …
There are 3 edges from nodes in the next-to-lowest rank (row) of the middle cluster to nodes in the top rank of the bottom cluster. Add minlen=2 to these edges (minlen | Graphviz). That should push the bottom cluster down, and (with luck) then underneath the middle cluster.

1 Like

Hi @ steveroush,

You were right, the issue was resolved after I added the correct minlen!

Thank you for the help.

You can also control the layout with osage layout and use “packmode” as explained here: Is there a way to draw “desks” (2 boxes side by side and 2 below them) without using arrows on graphviz? - Help - Graphviz

1 Like