Reputation: 37
I have a Graph
object and between each pair of nodes that already has an edge, I would like to add an additional edge? Is there a way to do this without brute force looping through all the edges?
Upvotes: 2
Views: 140
Reputation: 3064
A simple way to do this is:
temp = nx.Graph(our_graph)
new_graph = nx.MultiGraph(temp)
new_graph.add_edges_from(temp.edges)
Upvotes: 1