排序子图 Graphviz 中节点的重新排序
Reordering of nodes in ranked subgraph Graphviz
我正在创建一个工作流文档,用于标识我们在何处拥有一些工具。随着工作流程的扩展,我需要工具紧跟他们进行的步骤。换句话说,我需要从工作流中移出两列,以便在其他列被抽出之前为其他节点腾出空间,使其位于它们所在的节点旁边。抱歉,很难解释。这是代码,下面是它现在输出的图片,以及我想要它做什么。
digraph notebook {
/* Pills */
node [shape=box, style="rounded,filled", fillcolor="#d4eba7"]; pill1; pill2; pill3; pill4; pill5
pill1 [label="Pill 1"]
pill2 [label="Pill 2"]
pill3 [label="Pill 3"]
pill4 [label="Pill 4"]
pill5 [label="Pill 5"]
/* Objects */
node [shape=box, style="rounded,filled", fillcolor="#999999"]; obj1; obj2; obj3; obj4
obj1 [label="Obj1"]
obj2 [label="Obj2"]
obj3 [label="Obj3"]
obj4 [label="Obj4"]
/* Steps */
node [shape=box, style=filled, fillcolor="#ff9999"]; step1; step2; step3; step4; step5; step6
step1 [label="Step 1"]
step2 [label="Step 2"]
step3 [label="Step 3"]
step4 [label="Step 4"]
step5 [label="Step 5"]
step6 [label="Step 6"]
/* Tools */
node[shape=rect, style=filled, fillcolor="#b1ddf0"]; tool1; tool2; tool3; tool4; tool5; tool6; tool7_1; tool7_2; tool8; tool9;
tool1 [label="Tool 1", tooltip="description..."]
tool2 [label="Tool 2", tooltip="description..."]
tool3 [label="Tool 3", tooltip="description..."]
tool4 [label="Tool 4", tooltip="description..."]
tool5 [label="Tool 5", tooltip="description..."]
tool6 [label="Tool 6", tooltip="description..."]
tool7 [label="Tool 7", tooltip="description..."]
tool8 [label="Tool 8", tooltip="description..."]
tool9 [label="Tool 9", tooltip="description..."]
tool10 [label="Tool 10", tooltip="description..."]
/* Workflow */
subgraph subs1 {rank="same" step1 tool1 tool2}
subgraph subs2 {rank="same" step2 tool3 tool4}
subgraph subs3 {rank="same" step3 tool5 tool6 tool7}
subgraph subs4 {rank="same" obj2 obj3 obj4}
subgraph subs5 {rank="same" step4 tool8}
subgraph subs6 {rank="same" step5 tool9}
subgraph subs7 {rank="same" step6 tool10}
subgraph subs8 {rank="same" pill3 pill4 pill5}
pill1 -> obj1 -> step1 -> step2 -> step3 -> pill2
pill2 -> obj2 -> step4 -> step5 -> pill3
pill2 -> obj3 -> step6 -> pill4
pill2 -> obj4 -> pill5
}
当前输出:
Current Output:
Desired Output:
不可见的节点和边通常用于让节点位于您想要的位置。您的图表只需要几个:
digraph notebook {
/* Pills */
node [shape=box, style="rounded,filled", fillcolor="#d4eba7"]; pill1; pill2; pill3; pill4; pill5
pill1 [label="Pill 1"]
pill2 [label="Pill 2"]
pill3 [label="Pill 3"]
pill4 [label="Pill 4"]
pill5 [label="Pill 5"]
/* Objects */
node [shape=box, style="rounded,filled", fillcolor="#999999"]; obj1; obj2; objInvis2_1 objInvis2_2; obj3; obj4
obj1 [label="Obj1"]
obj2 [label="Obj2"]
objInvis2_1 [label="" style=invis]
objInvis2_2 [label="" style=invis]
obj3 [label="Obj3"]
obj4 [label="Obj4"]
/* Steps */
node [shape=box, style=filled, fillcolor="#ff9999"]; step1; step2; step3; step4; step5; step6
step1 [label="Step 1"]
step2 [label="Step 2"]
step3 [label="Step 3"]
step4 [label="Step 4"]
step5 [label="Step 5"]
step6 [label="Step 6"]
/* Tools */
/* removed tool7_1 and tool7_2 ???
node[shape=rect, style=filled, fillcolor="#b1ddf0"]; tool1; tool2; tool3; tool4; tool5; tool6; tool7_1; tool7_2; tool8; tool9;
*/
node[shape=rect, style=filled, fillcolor="#b1ddf0"]; tool1; tool2; tool3; tool4; tool5; tool6; tool8; tool9;
tool1 [label="Tool 1", tooltip="description..."]
tool2 [label="Tool 2", tooltip="description..."]
tool3 [label="Tool 3", tooltip="description..."]
tool4 [label="Tool 4", tooltip="description..."]
tool5 [label="Tool 5", tooltip="description..."]
tool6 [label="Tool 6", tooltip="description..."]
tool7 [label="Tool 7", tooltip="description..."]
tool8 [label="Tool 8", tooltip="description..."]
tool9 [label="Tool 9", tooltip="description..."]
tool10 [label="Tool 10", tooltip="description..."]
/* Workflow */
subgraph subs1 {rank="same" step1 tool1 tool2}
subgraph subs2 {rank="same" step2 tool3 tool4}
subgraph subs3 {rank="same" step3 tool5 tool6 tool7}
subgraph subs4 {rank="same" obj2 objInvis2_1 objInvis2_2 obj3 obj4}
subgraph subs5 {rank="same" step4 tool8}
subgraph subs6 {rank="same" step5 tool9}
subgraph subs7 {rank="same" step6 tool10}
subgraph subs8 {rank="same" pill3 pill4 pill5}
pill1 -> obj1 -> step1 -> step2 -> step3 -> pill2
pill2 -> obj2 -> step4 -> step5 -> pill3
pill2 -> obj3 -> step6 -> pill4
pill2 -> obj4 -> pill5
edge [style=invis]
node [style=invis label=""]
pill2 -> objInvis2_1 -> tool8 -> tool9
pill2 -> objInvis2_2 -> toolInvis -> tool10
}
我正在创建一个工作流文档,用于标识我们在何处拥有一些工具。随着工作流程的扩展,我需要工具紧跟他们进行的步骤。换句话说,我需要从工作流中移出两列,以便在其他列被抽出之前为其他节点腾出空间,使其位于它们所在的节点旁边。抱歉,很难解释。这是代码,下面是它现在输出的图片,以及我想要它做什么。
digraph notebook {
/* Pills */
node [shape=box, style="rounded,filled", fillcolor="#d4eba7"]; pill1; pill2; pill3; pill4; pill5
pill1 [label="Pill 1"]
pill2 [label="Pill 2"]
pill3 [label="Pill 3"]
pill4 [label="Pill 4"]
pill5 [label="Pill 5"]
/* Objects */
node [shape=box, style="rounded,filled", fillcolor="#999999"]; obj1; obj2; obj3; obj4
obj1 [label="Obj1"]
obj2 [label="Obj2"]
obj3 [label="Obj3"]
obj4 [label="Obj4"]
/* Steps */
node [shape=box, style=filled, fillcolor="#ff9999"]; step1; step2; step3; step4; step5; step6
step1 [label="Step 1"]
step2 [label="Step 2"]
step3 [label="Step 3"]
step4 [label="Step 4"]
step5 [label="Step 5"]
step6 [label="Step 6"]
/* Tools */
node[shape=rect, style=filled, fillcolor="#b1ddf0"]; tool1; tool2; tool3; tool4; tool5; tool6; tool7_1; tool7_2; tool8; tool9;
tool1 [label="Tool 1", tooltip="description..."]
tool2 [label="Tool 2", tooltip="description..."]
tool3 [label="Tool 3", tooltip="description..."]
tool4 [label="Tool 4", tooltip="description..."]
tool5 [label="Tool 5", tooltip="description..."]
tool6 [label="Tool 6", tooltip="description..."]
tool7 [label="Tool 7", tooltip="description..."]
tool8 [label="Tool 8", tooltip="description..."]
tool9 [label="Tool 9", tooltip="description..."]
tool10 [label="Tool 10", tooltip="description..."]
/* Workflow */
subgraph subs1 {rank="same" step1 tool1 tool2}
subgraph subs2 {rank="same" step2 tool3 tool4}
subgraph subs3 {rank="same" step3 tool5 tool6 tool7}
subgraph subs4 {rank="same" obj2 obj3 obj4}
subgraph subs5 {rank="same" step4 tool8}
subgraph subs6 {rank="same" step5 tool9}
subgraph subs7 {rank="same" step6 tool10}
subgraph subs8 {rank="same" pill3 pill4 pill5}
pill1 -> obj1 -> step1 -> step2 -> step3 -> pill2
pill2 -> obj2 -> step4 -> step5 -> pill3
pill2 -> obj3 -> step6 -> pill4
pill2 -> obj4 -> pill5
}
当前输出: Current Output:
Desired Output:
不可见的节点和边通常用于让节点位于您想要的位置。您的图表只需要几个:
digraph notebook {
/* Pills */
node [shape=box, style="rounded,filled", fillcolor="#d4eba7"]; pill1; pill2; pill3; pill4; pill5
pill1 [label="Pill 1"]
pill2 [label="Pill 2"]
pill3 [label="Pill 3"]
pill4 [label="Pill 4"]
pill5 [label="Pill 5"]
/* Objects */
node [shape=box, style="rounded,filled", fillcolor="#999999"]; obj1; obj2; objInvis2_1 objInvis2_2; obj3; obj4
obj1 [label="Obj1"]
obj2 [label="Obj2"]
objInvis2_1 [label="" style=invis]
objInvis2_2 [label="" style=invis]
obj3 [label="Obj3"]
obj4 [label="Obj4"]
/* Steps */
node [shape=box, style=filled, fillcolor="#ff9999"]; step1; step2; step3; step4; step5; step6
step1 [label="Step 1"]
step2 [label="Step 2"]
step3 [label="Step 3"]
step4 [label="Step 4"]
step5 [label="Step 5"]
step6 [label="Step 6"]
/* Tools */
/* removed tool7_1 and tool7_2 ???
node[shape=rect, style=filled, fillcolor="#b1ddf0"]; tool1; tool2; tool3; tool4; tool5; tool6; tool7_1; tool7_2; tool8; tool9;
*/
node[shape=rect, style=filled, fillcolor="#b1ddf0"]; tool1; tool2; tool3; tool4; tool5; tool6; tool8; tool9;
tool1 [label="Tool 1", tooltip="description..."]
tool2 [label="Tool 2", tooltip="description..."]
tool3 [label="Tool 3", tooltip="description..."]
tool4 [label="Tool 4", tooltip="description..."]
tool5 [label="Tool 5", tooltip="description..."]
tool6 [label="Tool 6", tooltip="description..."]
tool7 [label="Tool 7", tooltip="description..."]
tool8 [label="Tool 8", tooltip="description..."]
tool9 [label="Tool 9", tooltip="description..."]
tool10 [label="Tool 10", tooltip="description..."]
/* Workflow */
subgraph subs1 {rank="same" step1 tool1 tool2}
subgraph subs2 {rank="same" step2 tool3 tool4}
subgraph subs3 {rank="same" step3 tool5 tool6 tool7}
subgraph subs4 {rank="same" obj2 objInvis2_1 objInvis2_2 obj3 obj4}
subgraph subs5 {rank="same" step4 tool8}
subgraph subs6 {rank="same" step5 tool9}
subgraph subs7 {rank="same" step6 tool10}
subgraph subs8 {rank="same" pill3 pill4 pill5}
pill1 -> obj1 -> step1 -> step2 -> step3 -> pill2
pill2 -> obj2 -> step4 -> step5 -> pill3
pill2 -> obj3 -> step6 -> pill4
pill2 -> obj4 -> pill5
edge [style=invis]
node [style=invis label=""]
pill2 -> objInvis2_1 -> tool8 -> tool9
pill2 -> objInvis2_2 -> toolInvis -> tool10
}