- 是否有这样的代码可以生成具有以下坐标的图片:
import gvfrom pygraph.classes.graph import graph
from pygraph.classes.digraph import digraph
from pygraph.algorithms.searching import breadth_first_search
from pygraph.readwrite.dot import write
gr = graph()
pass
gr.add_nodes(["HOST(name)", "REDIS", "MEMCACHED", "File:port", "HOST(other-name)"])
gr.add_edge(("HOST(name)", "REDIS"))
gr.add_edge(("HOST(name)", "MEMCACHED"))
gr.add_edge(("HOST(name)", "File:port" ))
gr.add_edge(("HOST(other-name)", "File:port"))
dot = write(gr)
gvv = gv.readstring(dot)
gv.layout(gvv, "dot")gv.render(gvv, "png", "test.png")
他甚至跑了,但我不喜欢他在处决后回来的事实,除了静态图片和警告
Warning: node File, port port unrecognized
Warning: node File, port port unrecognized
就像传递函数的有效但不正确的语法一样。帮助我理解。