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

Which layout should I use to get non-overlapping edges in igraph in python?

我想制作一个没有重叠边的图表。我在 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)

这是结果

但我想要这样的东西

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

谢谢

layout_reingold_tilfordlayout_reingold_tilford_circular 是树形布局;它们用于树图。使用 layout_kamada_kawai()layout_fruchterman_reingold().

可能会更好

绘图时使用 hovermost 选项可能对您有所帮助

layout = h.layout("fruchterman_reingold")
igraph.plot(h, '2.png', layout=layout, bbox=(1000, 1000), margin=120, hovermode='closest')

我尝试了悬停模式,但它不在 igraph 包中。唯一有点帮助的想法是调整图形的大小,或者使用 tkplot 手动处理图形。