Example #1
0
 def test_paths(self):
     # Assert depth-first all paths.
     g = self.g.copy()
     g.add_edge("a", "d")
     for id1, id2, length, path in (("a", "a", 1, [["a"]]), ("a", "d", 3, [
         ["a", "d"], ["a", "b", "d"]
     ]), ("a", "d", 2, [["a", "d"]]), ("a", "d", 1, []), ("a", "x", 1, [])):
         p = graph.paths(g, id1, id2, length)
         self.assertEqual(p, path)
     print("pattern.graph.paths()")
Example #2
0
 def test_paths(self):
     # Assert depth-first all paths.
     g = self.g.copy()
     g.add_edge("a","d")
     for id1, id2, length, path in (
       ("a", "a", 1, [["a"]]),
       ("a", "d", 3, [["a","d"], ["a","b","d"]]),
       ("a", "d", 2, [["a","d"]]),
       ("a", "d", 1, []),
       ("a", "x", 1, [])):
         p = graph.paths(g, id1, id2, length)
         self.assertEqual(p, path)
     print "pattern.graph.paths()"