def main(script, n='10', *args): # create n Vertices n = int(n) labels = string.ascii_lowercase + string.ascii_uppercase vs = [] iter = misc.gen_identifier() for i in range(n): vs.append(Vertex(iter.next())) vs = [Vertex(c) for c in labels[:n]] #test_average_path_len() # create a graph and a layout #g = Graph(vs) #g = RandomGraph(vs) #g.is_connected g = SmallWorldGraph(vs) g.add_regular_ring_lattice(4) print g.all_pairs_shortest_path() #v = vs[0] #print v #print g.shortest_path(v) #w = vs[3] #print w #print g.shortest_path(v, w) #print g.get_max_neighbors() #print g.get_clustering_coefficient() #p = 0.8 #g.rewire(p) #print g.get_clustering_coefficient() #test_clustercoefficient() #g.add_random_edges(1.0) #print g.is_connected() # draw the graph layout = CircleLayout(g) gw = GraphWorld() gw.show_graph(g, layout) gw.mainloop()