Seeking help with the rank attribute

Context: I've been asked by a user of my Perl wrapper - GraphViz2 - around Graphviz, how to force nodes within a subgraph to be placed top-to-bottom, in an order specified by the user. So I looked at the rank attribute, but...

I find this part of the explanation of the rank attribute hard to follow:

If rank="source", all nodes are placed on the minimum rank, and the only nodes on the minimum rank belong to some subgraph whose rank attribute is "source" or "min".

How can it refer to 'all nodes', and also 'the only nodes'?

It means that all nodes in

It means that all nodes in the subgraph with rank=source will placed on the minimum rank, and the only nodes in the graph placed on the minimum rank must have been in a subgraph with rank=source or rank=min. If rank=source is not used, some unconstrained nodes may end up on the minimum rank. For example, in the graph

cat m.gv
digraph G {
  { rank=min c}
  a -> b
  c -> b

node c is guaranteed to be on the minimum rank, but node a will also be there since all other constraints are satisfied. If you change "min" to "source", node c will be on a rank all by itself.


Thanx for the clarification.

Recent comments