I would like to generate a NetworkX graph in a 2D grid with boundaries (100, 100) i.e x-axis ranges from (0,100) and y-axis ranges from (0,100).
import matplotlib.pyplot as plt
import networkx as nx
H = nx.gnm_random_graph(n=8, m=9, seed=5) # generate a random graph
pos = nx.spring_layout(H, iterations=500) # find good positions for nodes
nx.draw(H)
print(pos)
plt.show()
I would like to know how to scale the coordinates of nodes stored in pos
such that all nodes lie within boundary.