示例#1
0
 def test_regularity(self):
     """Tests that the generated graph is `k`-out-regular."""
     n = 10
     k = 3
     alpha = 1
     G = random_k_out_graph(n, k, alpha)
     assert all(d == k for v, d in G.out_degree())
     G = random_k_out_graph(n, k, alpha, seed=42)
     assert all(d == k for v, d in G.out_degree())
示例#2
0
 def test_regularity(self):
     """Tests that the generated graph is `k`-out-regular."""
     n = 10
     k = 3
     alpha = 1
     G = random_k_out_graph(n, k, alpha)
     assert_true(all(d == k for v, d in G.out_degree()))
     G = random_k_out_graph(n, k, alpha, seed=42)
     assert_true(all(d == k for v, d in G.out_degree()))
示例#3
0
 def test_no_self_loops(self):
     """Tests for forbidding self-loops."""
     n = 10
     k = 3
     alpha = 1
     G = random_k_out_graph(n, k, alpha, self_loops=False)
     assert nx.number_of_selfloops(G) == 0
示例#4
0
 def test_no_self_loops(self):
     """Tests for forbidding self-loops."""
     n = 10
     k = 3
     alpha = 1
     G = random_k_out_graph(n, k, alpha, self_loops=False)
     assert_equal(G.number_of_selfloops(), 0)