def test_directed_configuration_model_self_loops(self): G = directed_configuration_model( [10, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0], # in [2, 10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0], 0) self.assertEqual(G.degree(0), 12) self.assertEqual(G.degree(1), 11) self.assertEqual(G.degree(2), 5) self.assertEqual(G.degree(3), 0) self.assertEqual(G.degree(4), 0) self.assertEqual(G.degree(5), 0) self.assertEqual(G.degree(6), 0) self.assertEqual(G.degree(7), 0) self.assertEqual(G.degree(8), 0) self.assertEqual(G.degree(9), 0) self.assertEqual(G.degree(10), 0) self.assertEqual(G.degree(11), 0) self.assertEqual(G.selfloop_edges(), [])
def test_directed_configuration_model(self): G = directed_configuration_model( [2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], # in [0, 0, 2, 1, 1, 0, 0, 0, 1, 1, 0, 0], 0) # no self-loops were removed. self.assertEqual(G.degree(0), 2) self.assertEqual(G.degree(1), 2) self.assertEqual(G.degree(2), 2) self.assertEqual(G.degree(3), 1) self.assertEqual(G.degree(4), 1) self.assertEqual(G.degree(5), 0) self.assertEqual(G.degree(6), 0) self.assertEqual(G.degree(7), 0) self.assertEqual(G.degree(8), 1) self.assertEqual(G.degree(9), 1) self.assertEqual(G.degree(10), 1) self.assertEqual(G.degree(11), 1)
def test_directed_configuration_model_no_self_loops(self): G = directed_configuration_model( [2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], # in [0, 0, 2, 1, 1, 0, 0, 0, 1, 1, 0, 0], 0) self.assertEqual(G.selfloop_edges(), [])