python - 我应该使用哪种布局在 python 中的 igraph 中获得非重叠边缘?

标签 python igraph edges

我想制作一个没有重叠边的图。我在 igraph 库中使用 python。这是我的代码

import sys
import igraph
from igraph import *
import re

g = Graph([(1,2),(1,4),(1,7),(1,10),(1,12),(2,3),(2,4),(2,9),(3,4),(3,5),
(5,6)

layout = g.layout_reingold_tilford_circular()

plot(g, layout=layout)

这是结果

enter image description here

但我想要这样的东西

https://pbs.twimg.com/media/CM8r7sYUwAAEDy6.png

关于如何在 igraph 中执行此操作的任何帮助?我的图表不是树。

谢谢

最佳答案

layout_reingold_tilfordlayout_reingold_tilford_circular 是树形布局;它们用于 TreeMap 。您可能最好使用 layout_kamada_kawai()layout_fruchterman_reingold()

关于python - 我应该使用哪种布局在 python 中的 igraph 中获得非重叠边缘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32145966/

相关文章:

python - 当外部硬件连接失败时,我应该抛出什么Python异常?

python - 如何找到 N 个数字,其总和最接近 K 但在多个列上?

Python 意外的 StopIteration

java - neo4j:向 neo4j graphDB 中的节点和关系类型添加多个属性

python - 识别python中的动词时态

python - igraph:绘制同一图的递增增长子图时如何固定节点位置

r - 如何使用 igraph R 包比较两个图以识别两个图之间相同/不同边的数量

r - 在 R 中绘制 igraph 对象时控制轴标签大小

python - 是否可以在 Networkx 图中混合不同形状的节点?

algorithm - Bellman-Ford 算法轨迹