3

我正在尝试使用 graphviz 创建基于时间线的分支图。但是,当我尝试连接节点行以显示它们已从另一行节点分支时,顺序会变得混乱。有没有办法指定行的顺序?

我尝试过为节点使用各种等级设置,但似乎没有任何效果。我也尝试过不可见的节点和边缘,但这也无济于事。

我希望能够堆叠行,以便当从旧分支创建新分支时,它将出现在它分支的行上方。就目前的代码而言,分支以正确的顺序出现,但是当我尝试连接分支以显示关系时,就会出现顺序混乱的情况。有没有人有类似的经验?

digraph G{
ranksep = 0.05;
rankdir="LR";
node[width=0.5, height=0.5, shape=plaintext];
edge[weight=10, arrowhead=none];
"7/2014" -> "8/2014" -> "9/2014" -> "10/2014" -> "11/2014" -> "12/2014" -> "1/2015" -> "2/2015" -> "3/2015" -> "4/2015" -> "5/2015" -> "6/2015" -> "7/2015" -> "8/2015";

node[shape=square, style="filled,rounded", fillcolor=red];
"Trunk 7/2014" -> "Trunk 8/2014" -> "Trunk 9/2014" -> "Trunk 10/2014" -> "Trunk 11/2014" -> "Trunk 12/2014" -> "Trunk 1/2015" -> "Trunk 2/2015" -> "Trunk 3/2015" -> "Trunk 4/2015" -> "Trunk 5/2015" -> "Trunk 6/2015" -> "Trunk 7/2015" -> "Trunk 8/2015";

node[shape=square, style="filled,rounded", fillcolor=blue];
"Second 8/2014" -> "Second 9/2014" -> "Second 10/2014" -> "Second 11/2014" -> "Second 12/2014" -> "Second 1/2015" -> "Second 2/2015" -> "Second 3/2015" -> "Second 4/2015" -> "Second 5/2015" -> "Second 6/2015" -> "Second 7/2015" -> "Second 8/2015";

node[shape=square, style="filled,rounded", fillcolor=green];
"Third 10/2014" -> "Third 11/2014" -> "Third 12/2014";

{rank=same; "7/2014";"Trunk 7/2014";}
{rank=same; "8/2014";"Trunk 8/2014";"Second 8/2014";}
{rank=same; "9/2014";"Trunk 9/2014";"Second 9/2014";}
{rank=same; "10/2014";"Trunk 10/2014";"Second 10/2014";"Third 10/2014";}
{rank=same; "11/2014";"Trunk 11/2014";"Second 11/2014";"Third 11/2014";}
{rank=same; "12/2014";"Trunk 12/2014";"Second 12/2014";"Third 12/2014";}
{rank=same; "1/2015";"Trunk 1/2015";"Second 1/2015";}
{rank=same; "2/2015";"Trunk 2/2015";"Second 2/2015";}
{rank=same; "3/2015";"Trunk 3/2015";"Second 3/2015";}
{rank=same; "4/2015";"Trunk 4/2015";"Second 4/2015";}
{rank=same; "5/2015";"Trunk 5/2015";"Second 5/2015";}
{rank=same; "6/2015";"Trunk 6/2015";"Second 6/2015";}
{rank=same; "7/2015";"Trunk 7/2015";"Second 7/2015";}
{rank=same; "8/2015";"Trunk 8/2015";"Second 8/2015";}

"Trunk 8/2014" -> "Second 8/2014"
}
4

0 回答 0