Beispiel #1
0
 def test_undirected_paper_example(self):
     graph = retworkx.PyGraph()
     graph.add_nodes_from(list(range(21)))
     graph.add_edges_from_no_data(self.example_edges)
     res = retworkx.core_number(graph)
     self.assertIsInstance(res, dict)
     self.assertEqual(res, self.example_core)
Beispiel #2
0
 def test_undirected_all_3(self):
     graph = retworkx.PyGraph()
     graph.add_nodes_from(list(range(4)))
     graph.add_edges_from_no_data([(0, 1), (0, 2), (0, 3), (1, 2), (1, 3),
                                   (2, 3)])
     res = retworkx.core_number(graph)
     self.assertIsInstance(res, dict)
     self.assertEqual(res, {0: 3, 1: 3, 2: 3, 3: 3})
Beispiel #3
0
 def test_undirected_all_0(self):
     graph = retworkx.PyGraph()
     graph.add_nodes_from(list(range(4)))
     res = retworkx.core_number(graph)
     self.assertIsInstance(res, dict)
     self.assertEqual(res, {0: 0, 1: 0, 2: 0, 3: 0})
Beispiel #4
0
 def test_undirected_empty(self):
     graph = retworkx.PyGraph()
     res = retworkx.core_number(graph)
     self.assertIsInstance(res, dict)
     self.assertEqual(res, {})