def test_clustercoefficient(): ps = np.arange(0, 1, 0.01) n = 1000 e = 10 labels = string.ascii_lowercase + string.ascii_uppercase vs = [] iter = misc.gen_identifier() for i in range(n): vs.append(Vertex(iter.next())) g = SmallWorldGraph(vs) g.add_regular_ring_lattice(e) c0 = g.get_clustering_coefficient() xs = [] ys = [] for p in ps: g = SmallWorldGraph(vs) g.add_regular_ring_lattice(e) g.rewire(p) ys.append(g.get_clustering_coefficient() / c0) xs.append(p) fig = plt.figure(dpi = 100) plt.subplot(1,1,1) plt.plot(xs, ys) plt.xscale('log') plt.show()