April 2019
Beginner
190 pages
4h 54m
English
Typically, most of an individual's acquaintances are others who live in the same area. If every individual was only acquainted with others who lived near them, you would expect it to require many more than six hops to send a message from Kansas to Massachusetts, because each hop could only cross a short distance. Such a network can be modeled as a k-ring: nodes arranged around a circle, with each node connected to the nearest k/2 nodes on each side. The following example creates and visualizes a four-ring using the watts_strogatz_graph() function (which will be discussed later in the section).
G_small_ring = nx.watts_strogatz_graph(16, 4, 0)pos = nx.circular_layout(G_small_ring)nx.draw_networkx(G_small_ring, pos=pos, with_labels=False) ...
Read now
Unlock full access