MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

graphs/bidirectional_a_star.py:44–61  ·  view source on GitHub ↗
(
        self,
        pos_x: int,
        pos_y: int,
        goal_x: int,
        goal_y: int,
        g_cost: int,
        parent: Node | None,
    )

Source from the content-addressed store, hash-verified

42 """
43
44 def __init__(
45 self,
46 pos_x: int,
47 pos_y: int,
48 goal_x: int,
49 goal_y: int,
50 g_cost: int,
51 parent: Node | None,
52 ) -> None:
53 self.pos_x = pos_x
54 self.pos_y = pos_y
55 self.pos = (pos_y, pos_x)
56 self.goal_x = goal_x
57 self.goal_y = goal_y
58 self.g_cost = g_cost
59 self.parent = parent
60 self.h_cost = self.calculate_heuristic()
61 self.f_cost = self.g_cost + self.h_cost
62
63 def calculate_heuristic(self) -> float:
64 """

Callers

nothing calls this directly

Calls 1

calculate_heuristicMethod · 0.95

Tested by

no test coverage detected