如何在 pydot 中的两个子图之间添加边?
有谁知道如何在 pydot 中的两个子图(簇)之间添加边?
callgraph = pydot.Dot(graph_type='digraph',fontname="Verdana")
cluster_foo=pydot.Cluster('foo',label='foo')
cluster_foo.add_node(pydot.Node('foo_method_1',label='method_1'))
callgraph.add_subgraph(cluster_foo)
cluster_bar=pydot.Cluster('bar',label='Component1')
cluster_bar.add_node(pydot.Node('bar_method_a'))
callgraph.add_subgraph(cluster_bar)
我尝试过:
callgraph.add_edge(pydot.Edge("foo","bar"))
但不起作用。它只是在初始图中再创建两个标记为“foo”和“bar”的节点,并在它们之间放置一条边!
有人可以帮忙吗?
Does anyone know how to add an edge between two subgraphs (clusters) in pydot?
callgraph = pydot.Dot(graph_type='digraph',fontname="Verdana")
cluster_foo=pydot.Cluster('foo',label='foo')
cluster_foo.add_node(pydot.Node('foo_method_1',label='method_1'))
callgraph.add_subgraph(cluster_foo)
cluster_bar=pydot.Cluster('bar',label='Component1')
cluster_bar.add_node(pydot.Node('bar_method_a'))
callgraph.add_subgraph(cluster_bar)
I tried:
callgraph.add_edge(pydot.Edge("foo","bar"))
but doesn't work. It just creates two more nodes labeled "foo" and "bar" in the initial graph and puts an edge between them!
Can anyone help, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以你的代码将变成:
So your code would become: