networkx 中的有向图结构,两个节点之间有两条边
Directed Graph Structure in networkx with two edges between two nodes
我希望有两条有向边连接两个相反方向的节点。目前我有以下内容,但它只显示一个带有两个箭头的边。
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()
我在这里找到了答案: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()
我希望有两条有向边连接两个相反方向的节点。目前我有以下内容,但它只显示一个带有两个箭头的边。
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()
我在这里找到了答案: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()