Could we implement support of DOT rank for better leveling/ordering of components?

0 votes
asked Dec 4, 2019 in Wanted features by boshka (3,940 points)
edited Dec 9, 2019 by boshka

Graphviz/DOT support rank attribute for placing the elements on the same level. 

It looks that we could also rather easily support it in plantuml component diagrams. Probably, we could just do like this: http://www.plantuml.com/plantuml/uml/NSun3i8m38NX_PtYgJDS0HKuYUCQY6WSb9W9SNSW4-ho3z_qppsanREim6gNO5IsVBq5bznC8rS7j9P7TVFWT9medS8Ntlzy6fosV1wiWo7xG_f5WIP-PvTYJ3i5PlFbU_01

wherein:

  1. multiple directives are needed to be supported by plantuml, such as:
    rank same b,c - places components b and c on the same level
    rank sink a  - sinks component a to the bottom
    ...
    etc.
  2. values or rank to support are:
    • same (as in the example)
    • source
    • max
    • sink

Details on the rank attribute

Here is the example: https://www.tonyballantyne.com/graphs.html#orgheadline15

digraph hierarchy {

		nodesep=1.0 // increases the separation between nodes
		
		node [color=Red,fontname=Courier,shape=box] //All nodes will this shape and colour
		edge [color=Blue, style=dashed] //All the lines look like this

		Headteacher->{Deputy1 Deputy2 BusinessManager}
		Deputy1->{Teacher1 Teacher2}
		BusinessManager->ITManager
		{rank=same;ITManager Teacher1 Teacher2}  // Put them on the same level
}

Here is the link of the same on Plantuml server:

http://www.plantuml.com/plantuml/uml/PP11Jp8n48RFy2lc1_1z25TJ4z637aoCuMOy3DjNsb3QpRGL2U6_Erqs9CPJt-oypvEPjNuht3jo7iBIkIETfjF992QBZDui_j_GV4u-TWBEo5GSI0SiN7oAj44v0966ld8ZIkzT2adC6-piCyKIUG_paAfuo2mxxc4swVj3rVSXN60wU8t5-Kn3WJXQQfOgAeNTNgMhK36ZN8u1nd9siADeM2xugBAGqaxZ3eEnNVG4jWNSESY_kzCZ-bgE2xgyIrhLtBZymf6taBC2OqNBwmkse34is_WteSxdzHXrU1AEEvFrwjlhP_gheVPlNsjfY-yfnVPIeoZW2s5w_W40

Here is the specification from Graphviz:

https://www.graphviz.org/pdf/dotguide.pdf

In graphs with time-lines, or in drawings that emphasize source and sink nodes, you may need to constrain rank assignments. The rank of a subgraph may be set to same, min, source, max or sink. A value same causes all the nodes in the subgraph to occur on the same rank. If set to min, all the nodes in the subgraph are guaranteed to be on a rank at least as small as any other node in the layout7 . This can be made strict by setting rank=source, which forces the nodes in the subgraph to be on some rank strictly smaller than the rank of any other nodes (except those also specified by min or source subgraphs). The values max or sink play an analogous role for the maximum rank. Note that these constraints induce equivalence classes of nodes. If one subgraph forces nodes A and B to be on the same rank, and another subgraph forces nodes C and B to share a rank, then all nodes in both subgraphs must be drawn on the same rank. Figures 11 and 12 illustrate using subgraphs for controlling rank assignment. 

commented Aug 24, 2021 by boshka (3,940 points)
hi Plantuml team,

could you review this and confirm it is possible to support?
commented Oct 13, 2022 by boshka (3,940 points)
hi Plantuml team!

Any response on this one?
commented Oct 17, 2022 by boshka (3,940 points)
edited Oct 18, 2022 by boshka
well, when you generate a diagram by script, you know only the rank of the component. Since it can have multiple links, you are not able to easily determine and put the correct rank using the arrows, i.e. ->. -->,  --->, etc.
Therefore, I'd like to have an ability to define rank of the component when it gets declared.

like:

component A as "a" rank 1 {
}

component B as "b" rank 2 {
}

component C as "c" rank 1 {
}

or the way it was proposed here:

http://www.plantuml.com/plantuml/uml/NSun3i8m38NX_PtYgJDS0HKuYUCQY6WSb9W9SNSW4-ho3z_qppsanREim6gNO5IsVBq5bznC8rS7j9P7TVFWT9medS8Ntlzy6fosV1wiWo7xG_f5WIP-PvTYJ3i5PlFbU_01

etc.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...