Example #1
0
    def time_astar_shortest_path(self, num_nodes, __):
        def match_goal(x):
            return x == 1

        retworkx.astar_shortest_path(
            self.graph, 0, match_goal, float, lambda x: self.graph.out_degree(x)
        )
Example #2
0
    def time_astar_shortest_path(self, directed):
        def match_goal(x):
            return x == 5123

        if directed:
            retworkx.astar_shortest_path(
                self.graph, 0, match_goal, float, lambda x: self.graph.out_degree(x)
            )
        else:
            retworkx.astar_shortest_path(
                self.graph, 0, match_goal, float, lambda x: self.graph.degree(x)
            )
Example #3
0
 def test_astar_shortest_path(self):
     res = retworkx.astar_shortest_path(self.graph, 0, lambda _: True,
                                        lambda _: 1, lambda _: 1)
     self.assertIsInstance(list(res), list)