【问题标题】:Why does Graphviz/Dot act so weirdly to this particular code?为什么 Graphviz/Dot 对这个特定代码的行为如此奇怪?
【发布时间】:2012-12-24 12:22:40
【问题描述】:

我在 Windows 7 上使用 GraphViz 2.28 (the current stable version),以下代码导致 Graphviz/Dot 崩溃。

digraph G {
ranksep = 1.0; size = "10,10";
{
    node [shape = plaintext, fontsize = 20];
    GAWM1 -> GAWM2 -> 0;
}

node [shape = box];
{rank = same;0;wx1;wx2;rx1;}

wx1 -> wx2;
wx2 -> rx1;
wx1 -> rx1[color = blue];

subgraph struct
{
    node [shape = record];
    rx11 [shape = record, label = "rx1 | [x=[wx2]]"];
}
{rank = same; GAWM1; "rx11";}

// W'WR Order:
wx2 -> wx1[style = dashed, color = red, label = "1"]; }

当我对这个例子进行一些实验时,事情变得很奇怪:

  1. 最后一条语句“wx2 -> wx1[style = dashed, color = red, label = "1"];" 时效果很好被移除;
  2. 去掉第八行“{rank = same;0;wx1;wx2;rx1;}”时效果很好;
  3. 删除最后一条语句中的标签(即“, label = “1””)时也能正常工作。

我已将问题报告给Graphviz Issue Tracker,尚未回复。你能帮忙找出原因吗?

谢谢。

【问题讨论】:

  • 我试过你的脚本,遇到了 dot.exe 和 gvedit.exe 的崩溃。 Circo.exe 和 Neato.exe 在此示例上工作正常。
  • @AxelKemper 感谢您的反馈。但是,Graphviz 网站上关于 Circo 和 Neato 的陈述对我来说没有意义。如果我想使用 Circo 或 Neato,你能解释一下我应该怎么做吗?再次感谢。
  • Graphviz 提供了几个相关但不同的布局引擎。当图形节点可以很好地以圆形排列显示时,Circo 是我的最爱。请参阅graphviz.org 您的示例包含一个“子图”。因此,您可能与“dot.exe”(“'分层'或有向图的分层绘图。这是边缘具有方向性时使用的默认工具。”)

标签: graphviz dot graph-visualization


【解决方案1】:

您的脚本的以下变体不会崩溃:

digraph G {
ranksep = 1.0; size = "10,10";
{
    node [shape = plaintext, fontsize = 20];
    GAWM1 -> GAWM2 -> 0;
}
node [shape = box];
{rank = same;0;wx1;wx2;rx1;}
wx1 -> wx2;
wx2 -> rx1;
wx1 -> rx1[color = blue];
subgraph struct
{
    node [shape = record];
    rx11 [shape = record, label = "rx1 | [x=[wx2]]"];
}
{rank = same; GAWM1; "rx11";}
// W'WR Order:
//wx2 -> wx1[style = dashed, color = red, label = "1"]; 
wx2 -> wx1 [style=dashed, color=red];
}

看起来像wx1wx2 之间短边的label 的错误。

【讨论】:

  • 是的,我做过这样的实验,并在我的问题中提到过。但是,我想保留标签,表明我的情况很重要。还有其他建议吗?谢谢你。 (我会尝试 Circo 和 Neato。)
猜你喜欢
  • 2022-10-15
  • 1970-01-01
  • 2015-10-23
  • 2021-11-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多