예제 #1
0
 def test_lattice6(self):
     G = pr.generateGraph("lattice", N=6400, dim=3)
     assert len(G.nodes()) == 5832
     assert len(G.edges()) == 16524
     degrees = nx.average_neighbor_degree(G).values()
     ave_degree = reduce(lambda x, y: x + y, degrees) / len(degrees)
     assert int(round(ave_degree)) == 6
예제 #2
0
 def test_lattice3(self):
     G = pr.generateGraph("lattice", N=1000, dim=2)
     assert len(G.nodes()) == 961
     assert len(G.edges()) == 1860
     degrees = nx.average_neighbor_degree(G).values()
     ave_degree = reduce(lambda x, y: x + y, degrees) / len(degrees)
     assert int(round(ave_degree)) == 4
예제 #3
0
 def test_geometric6(self):
     G = pr.generateGraph("geometric", N=6400, dim=3, k=2)
     assert len(G.nodes()) == 6400
     degrees = nx.average_neighbor_degree(G).values()
     ave_degree = reduce(lambda x, y: x + y, degrees) / len(degrees)
     assert int(round(ave_degree)) == 2