Graphviz,没有rankdir

时间:2014-02-01 20:17:04

标签: graphviz

这个图是由一个程序生成的,我没有输入这个(我不希望任何人想到我会这样,这种格式是如此......人为的)

digraph G {
     rankdir=LR
     n0_0_ [label = "[0, 0]"]
     n0_0_  ->  n0_0_
     n0_1_ [label = "[0, 1]"]
     n0_0_  ->  n0_1_
     n0_1_  ->  n0_0_
     n1_0_ [label = "[1, 0]"]
     n0_0_  ->  n1_0_
     n1_0_  ->  n0_0_
     n1_1_ [label = "[1, 1]"]
     n0_0_  ->  n1_1_
     n1_1_  ->  n0_0_
}

Graphviz在左侧放置了[0,0],在右侧放置了下一个等级。

然而,在中心和其余3个节点周围有[0,0]更有意义。

从[0,0]到它自身的弧将被省略,对于应用程序来说重要的是graphviz没有尝试用等级构造它,可以开发可爱的对称性,为什么我不希望graphviz看到它和利用它,它使用的方法(弹簧IIRC上的能量方法)应该创造正确的形式!

如何说“没有rankdir”或其他相似之处?是有向图的副产品吗?

修改

不,它不是有向图的副产品,正如你可以看到的那样,我想另一种方式来说这个目标是“没有交叉边缘”,图形是平面的。

graph G {
     n0_0_ [label = "[0, 0]"]
     n0_0_  --  n0_0_
     n0_1_ [label = "[0, 1]"]
     n0_0_  --  n0_1_
     n0_1_  --  n0_2_
     n0_2_  --  n0_3_
     n0_3_  --  n0_4_
     n0_4_  --  n0_0_
     n0_2_ [label = "[0, 2]"]
     n0_0_  --  n0_2_
     n0_2_  --  n0_4_
     n0_4_  --  n0_1_
     n0_1_  --  n0_3_
     n0_3_  --  n0_0_
     n0_3_ [label = "[0, 3]"]
     n0_0_  --  n0_3_
     n0_3_  --  n0_1_
     n0_1_  --  n0_4_
     n0_4_  --  n0_2_
     n0_2_  --  n0_0_
     n0_4_ [label = "[0, 4]"]
     n0_0_  --  n0_4_
     n0_4_  --  n0_3_
     n0_3_  --  n0_2_
     n0_2_  --  n0_1_
     n0_1_  --  n0_0_
     n1_0_ [label = "[1, 0]"]
     n0_0_  --  n1_0_
     n1_0_  --  n2_0_
     n2_0_  --  n3_0_
     n3_0_  --  n4_0_
     n4_0_  --  n0_0_
     n1_1_ [label = "[1, 1]"]
     n0_0_  --  n1_1_
     n1_1_  --  n2_2_
     n2_2_  --  n3_3_
     n3_3_  --  n4_4_
     n4_4_  --  n0_0_
     n1_2_ [label = "[1, 2]"]
     n0_0_  --  n1_2_
     n1_2_  --  n2_4_
     n2_4_  --  n3_1_
     n3_1_  --  n4_3_
     n4_3_  --  n0_0_
     n1_3_ [label = "[1, 3]"]
     n0_0_  --  n1_3_
     n1_3_  --  n2_1_
     n2_1_  --  n3_4_
     n3_4_  --  n4_2_
     n4_2_  --  n0_0_
     n1_4_ [label = "[1, 4]"]
     n0_0_  --  n1_4_
     n1_4_  --  n2_3_
     n2_3_  --  n3_2_
     n3_2_  --  n4_1_
     n4_1_  --  n0_0_
     n2_0_ [label = "[2, 0]"]
     n0_0_  --  n2_0_
     n2_0_  --  n4_0_
     n4_0_  --  n1_0_
     n1_0_  --  n3_0_
     n3_0_  --  n0_0_
     n2_1_ [label = "[2, 1]"]
     n0_0_  --  n2_1_
     n2_1_  --  n4_2_
     n4_2_  --  n1_3_
     n1_3_  --  n3_4_
     n3_4_  --  n0_0_
     n2_2_ [label = "[2, 2]"]
     n0_0_  --  n2_2_
     n2_2_  --  n4_4_
     n4_4_  --  n1_1_
     n1_1_  --  n3_3_
     n3_3_  --  n0_0_
     n2_3_ [label = "[2, 3]"]
     n0_0_  --  n2_3_
     n2_3_  --  n4_1_
     n4_1_  --  n1_4_
     n1_4_  --  n3_2_
     n3_2_  --  n0_0_
     n2_4_ [label = "[2, 4]"]
     n0_0_  --  n2_4_
     n2_4_  --  n4_3_
     n4_3_  --  n1_2_
     n1_2_  --  n3_1_
     n3_1_  --  n0_0_
     n3_0_ [label = "[3, 0]"]
     n0_0_  --  n3_0_
     n3_0_  --  n1_0_
     n1_0_  --  n4_0_
     n4_0_  --  n2_0_
     n2_0_  --  n0_0_
     n3_1_ [label = "[3, 1]"]
     n0_0_  --  n3_1_
     n3_1_  --  n1_2_
     n1_2_  --  n4_3_
     n4_3_  --  n2_4_
     n2_4_  --  n0_0_
     n3_2_ [label = "[3, 2]"]
     n0_0_  --  n3_2_
     n3_2_  --  n1_4_
     n1_4_  --  n4_1_
     n4_1_  --  n2_3_
     n2_3_  --  n0_0_
     n3_3_ [label = "[3, 3]"]
     n0_0_  --  n3_3_
     n3_3_  --  n1_1_
     n1_1_  --  n4_4_
     n4_4_  --  n2_2_
     n2_2_  --  n0_0_
     n3_4_ [label = "[3, 4]"]
     n0_0_  --  n3_4_
     n3_4_  --  n1_3_
     n1_3_  --  n4_2_
     n4_2_  --  n2_1_
     n2_1_  --  n0_0_
     n4_0_ [label = "[4, 0]"]
     n0_0_  --  n4_0_
     n4_0_  --  n3_0_
     n3_0_  --  n2_0_
     n2_0_  --  n1_0_
     n1_0_  --  n0_0_
     n4_1_ [label = "[4, 1]"]
     n0_0_  --  n4_1_
     n4_1_  --  n3_2_
     n3_2_  --  n2_3_
     n2_3_  --  n1_4_
     n1_4_  --  n0_0_
     n4_2_ [label = "[4, 2]"]
     n0_0_  --  n4_2_
     n4_2_  --  n3_4_
     n3_4_  --  n2_1_
     n2_1_  --  n1_3_
     n1_3_  --  n0_0_
     n4_3_ [label = "[4, 3]"]
     n0_0_  --  n4_3_
     n4_3_  --  n3_1_
     n3_1_  --  n2_4_
     n2_4_  --  n1_2_
     n1_2_  --  n0_0_
     n4_4_ [label = "[4, 4]"]
     n0_0_  --  n4_4_
     n4_4_  --  n3_3_
     n3_3_  --  n2_2_
     n2_2_  --  n1_1_
     n1_1_  --  n0_0_
}

它真的不能很好地表达这一点。

ordering=out有所帮助,但仍然有非常明确的排名

1 个答案:

答案 0 :(得分:1)

dot应该适用于有向图并使用节点排名。

neatocircosfdp等其他布局可能会在您的情况下产生更好的结果。