Small world using networkx
[2]:
import networkx as nx
import pop2net as p2n
class MyAgent(p2n.Actor):
pass
class SmallWorld(p2n.LocationDesigner):
nxgraph = nx.watts_strogatz_graph(n=50, k=4, p=0.05)
env = p2n.Environment()
creator = p2n.Creator(env)
inspector = p2n.NetworkInspector(env)
env.add_actors([p2n.Actor() for _ in range(50)])
creator.create_locations(location_designers=[SmallWorld])
inspector.plot_networks()