端口在DOT文件中无法识别?

时间:2014-11-06 09:13:23

标签: python dot pygraphviz

我正在尝试从DOT文件创建PNG dot -Tpng -o temp.png
我收到以下错误: Warning: node s1, port eth2 unrecognized Warning: node s2, port eth2 unrecognized Warning: node s2, port eth3 unrecognized Warning: node s3, port eth2 unrecognized Warning: node s4, port eth4 unrecognized Warning: node s3, port eth3 unrecognized

DOT FILE 1: graph G { node [shape=record]; graph [hostidtype="hostname", version="1:0", date="04/12/2013"]; edge [dir=none, len=1, headport=center, tailport=center]; "s1":"eth2" -- "s2":"eth2"; "s2":"eth3" -- "s3":"eth2"; "s4":"eth4" -- "s3":"eth3"; }

当我尝试使用以下拓扑文件时,它可以正常工作。

DOT FILE 2 graph G { node [shape=record]; graph [hostidtype="hostname", version="1:0", date="04/12/2013"]; edge [dir=none, len=1, headport=center, tailport=center]; "R1":"swp1" -- "R3":"swp3"; "R1":"swp2" -- "R4":"swp3"; }


这有什么区别。出于什么原因,DOT FILE 1会出错?

2 个答案:

答案 0 :(得分:0)

港口位置是“罗盘点”。来自http://www.graphviz.org/doc/info/attrs.html#k:portPos

的文档
  

如果使用罗盘点,则必须具有该表格   “N”, “NE”, “E”, “本质上”, “S”, “SW”, “W”, “NW”, “C”, “”。这会修改边缘   放置以瞄准端口上相应的罗盘点,或   在节点本身上没有提供portname的第二种形式。   罗盘点“c”指定节点或端口的中心。该   罗盘点“”指定端口的适当侧   如果存在,则应使用邻近节点外部的节点。   否则,使用中心。如果没有使用罗盘点   portname,默认值为“_”。

答案 1 :(得分:0)

您的示例缺少一些信息(节点的描述)。假设它们在某处并且刚从您的示例中省略, 也许问题是使用node [shape=record]并不能使用port HTML属性。例如,尝试node [shape=plaintext]