def test_get_dist_matrix(self): g = Graph() g.add_node("new") g.add_node("node") g.add_node("test") g.add_edge("new", "node") g.add_edge("node", "test", 45) mat = g.get_dist_matrix() self.assertEqual( mat, { "new": { "new": 999999, "node": 999998, "test": 999999 }, "node": { "new": 999999, "node": 999999, "test": 45 }, "test": { "new": 999999, "node": 999999, "test": 999999 } })
def test_get_dist_matrix_empty_graph(self): g = Graph() mat = g.get_dist_matrix() self.assertEqual(mat, {})