I am trying to simulate a network growth by having edges connecting to different nodes. The following code, when run, displays the entire sequence of edges and nodes simultaneously. But how do i show one edge getting added to another after a delay of n units of time (in the same graph). I understand i have to use 'animation' package but am not sure how
import networkx as nx
import matplotlib.pyplot as plt
def f1(g):
nodes = set([a for a, b in g] + [b for a, b in g])
G=nx.Graph()
for node in nodes:
G.add_node(node)
for edge in g:
G.add_edge(edge[0], edge[1])
pos = nx.shell_layout(G)
nx.draw(G, pos)
plt.show()
g = [(10, 11),(11, 12),(12, 13), (13, 15),(15,10)]
f1(g)
I hope the intendation is correct. When the code is run, a graph does show up, but how to have each edge appearing one after the other, instead of appearing simultaneously.