Reputation: 127
I am looking to have two directed edges connecting two nodes going in opposite directions. Currently I have the following, but it only shows one edge with two arrows.
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()
Upvotes: 0
Views: 926
Reputation: 127
I found an answer here: 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()
Upvotes: 0