我正在尝试绘制一个将枚举所有可能项目集列表的图表。它应该是这样的:
但我现在得到了这个:
我尝试使用DOT语言,但它并没有像布局那样出现。我的点代码是
digraph item_set {
// the first layer
A [label = "abcd=>{}"];
// the second layer
B1 [label = "bcd=>a"];
B2 [label = "acd=>b"];
B3 [label = "abd=>c"];
B4 [label = "abc=>d"];
// the third layer
C1 [label = "cd=>ab"];
C2 [label = "bd=>ac"];
C3 [label = "bc=>ad"];
C4 [label = "ad=>bc"];
C5 [label = "ac=>bd"];
C6 [label = "ab=>cd"];
// the forth layer
D1 [label = "d=>abc"];
D2 [label = "c=>abd"];
D3 [label = "b=>acd"];
D4 [label = "a=>bcd"];
// draw line between the first layer and the second layer
A -> {B1, B2, B3, B4} [dir = none];
// draw line between the second layer and the third layer
{B1, B2} -> C1 [dir = none];
{B1, B3} -> C2 [dir = none];
{B1, B4} -> C3 [dir = none];
{B2, B3} -> C4 [dir = none];
{B2, B4} -> C5 [dir = none];
{B3, B4} -> C6 [dir = none];
// draw line between the second layer and the third layer
{C1, C2, C4} -> D1 [dir = none];
{C1, C3, C5} -> D2 [dir = none];
{C2, C3, C6} -> D3 [dir = none];
{C4, C5, C6} -> D4 [dir = none]; }
答案 0 :(得分:0)
可以使用tailport
控制边缘尾部接触起始节点的位置。可以使用headport
digraph G {
edge [dir=none]
a -> b [color=red headport="n" tailport="s"]
a -> c [headport="w" tailport="s"]
}
添加行:
a [style=filled fillcolor="turquoise"]
在结束括号填充节点a
之前。
可以使用命名的子图簇将一组节点放置在边界内。可以设置群集的边界。完整的代码是:
digraph G {
edge [dir=none]
a -> b [color=red headport="n" tailport="s"]
a -> c [headport="w" tailport="s"]
subgraph cluster_0 {
style="dashed"
label="Low-Confidence\nRule"
a [style=filled fillcolor="turquoise"]
}
}
答案 1 :(得分:0)