我正在寻找两个指向两个方向相反的节点的有向边。目前,我有以下内容,但仅显示带有两个箭头的一条边。
import networkx as nx
import itertools
abc=[n1 for n1 in itertools.permutations([1,2,3],2)]
G1 = nx.MultiDiGraph()
G1.add_edges_from(abc)
nx.draw_networkx(G1)
plt.show()
答案 0 :(得分:0)
我在这里找到了答案:Drawing multiple edges between two nodes with networkx
import networkx as nx
import itertools
abc=[n1 for n1 in itertools.permutations([1,2,3],2)]
G1 = nx.MultiDiGraph()
G1.add_edges_from(abc)
pos = nx.spring_layout(G1)
nx.draw_networkx(G1,pos,with_labels=True,connectionstyle='arc3, rad = 0.1')
plt.show()