没有重叠边缘与定位节点

时间:2018-01-05 15:33:40

标签: graphviz path-finding dot overlapping neato

无重叠选项(overlap = false)和定位(" -n2"命令行参数)不兼容。

strict graph {
  overlap=false;
  1 [label="", xlabel=<<FONT POINT-SIZE="7">1</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="120.4,31.1!"];
  2 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">2</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="73,35.5!"];
  3 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">3</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="236.2,35.2!"];
  4 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">4</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="350,100!"];
  5 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">5</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="350,90!"];
  6 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">6</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="350,80!"];
  1 -- 4 [arrowhead=none, shape=none];
  2 -- 5 [arrowhead=none, shape=none];
  3 -- 6 [arrowhead=none, shape=none];
}

执行以下命令行时:

neato -n2 -Tpng -ographviz-overlap-test.png graphviz-overlap-test.dotty

我得到了以下结果:

graphviz overlap test dot file

您是否知道生成与无重叠边连接的节点图的替代解决方案?

提前致谢,

1 个答案:

答案 0 :(得分:0)

只要您告诉graphviz节点的确切位置,就没有机会避免与您正在使用的代码重叠。我手动交换了节点1和2的位置,这样就重新排序了节点。我猜你用其他软件生成dotty文件,这是罪魁祸首。

strict graph {
  overlap=false;
  1 [label="", xlabel=<<FONT POINT-SIZE="7">1</FONT>>,
    shape=circle, style=filled, width=0.05, pin=true, pos="73,35.5!"];
    #                                                 ^^^^^^^^^^^^^^
  2 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">2</FONT>>,
    shape=circle, style=filled, width=0.05, pin=true, pos="120.4,31.1!"];
    #                                                 ^^^^^^^^^^^^^^^^^
  3 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">3</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="236.2,35.2!"];
  4 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">4</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="350,100!"];
  5 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">5</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="350,90!"];
  6 [label="", labelfontsize="5", xlabel=<<FONT POINT-SIZE="7">6</FONT>>, shape=circle, style=filled, width=0.05, pin=true, pos="350,80!"];
  1 -- 4 [arrowhead=none, shape=none];
  2 -- 5 [arrowhead=none, shape=none];
  3 -- 6 [arrowhead=none, shape=none];
}

产生

enter image description here