当rankdir为LR时,为什么同一rank的节点不是从上到下而是从下往上排序?

When rankdir is LR, why are the nodes in the same rank ordered bottom to top instead of top to bottom?

在下面的例子中,子图中的节点是从下到上而不是从上到下排序的。如何反转,以便从左上角开始,子图中的节点从上到下排序(A1-A4 和 B1-B4)?

digraph ab
{
  rankdir=LR
  splines=ortho
  ranksep=1
  node[shape = record]

  subgraph cluster_0 
  {
    label="A"
    { 
      rank = "same"
      state0_anchor [label="", style=invis, width=0]
      state0_step0 [label="A1"]
      state0_step1 [label="A2"]
      state0_step2 [label="A3"]
      state0_step3 [label="A4"]
    }
    state0_anchor->state0_step0[style = invis]
    state0_step0 -> state0_step1 -> state0_step2 -> state0_step3
  }

  state0_step3 -> state0_step0 [constraint=false]
  state0_step3 -> state1_step0 [constraint=false]

  subgraph cluster_state1 
  {
    label="B"
    { 
      rank = "same"
      state1_anchor [label="", style=invis,  width=0, height=0]
      state1_step0 [label="B1"]
      state1_step1 [label="B2"]
      state1_step2 [label="B3"]
      state1_step3 [label="B4"]
    }
    state1_anchor->state1_step0[style = invis]
    state1_step0 -> state1_step1 -> state1_step2 -> state1_step3
  }
  state1_step3 -> state0_step0 [constraint=false]

  state0_anchor -> state1_anchor[style = invis]
  start -> state0_step0
}

在您的示例中,当子图中边的方向反转时,节点将按您喜欢的方式排序。像这样:

state0_step3 -> state0_step2 [dir=rev]
state0_step2 -> state0_step1 [dir=rev]
state0_step1 -> state0_step0 [dir=rev]
state0_step0 -> state0_anchor [style = invis]

state1-nodes 相同。

有关 LR 时转换的详细信息,请参阅