TL;DR
I often analyzed using networkx, so a brief note I may write an article soon
I want to fix it because a different network is generated every time I write it in spring layout. If you fix random seed of numpy, you can fix the generated network.
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
np.random.seed(10)
G = nx.read_gml("/path/to/gmlfile")
pos = nx.spring_layout(G)
fig, ax = plt.subplots()
nx.draw_networkx_nodes(G, pos, ax=ax)
nx.draw_networkx_edges(G, pos, ax=ax)
plt.show()
Recommended Posts