Skip to content

Commit b374cae

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a161efa commit b374cae

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

graphs/a_star.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
the actual distance from the start (g-score) and the estimated distance to
77
the goal (h-score) using the formula: f(n) = g(n) + h(n).
88
9-
Time Complexity: O(E log V) where E is the number of edges and V is the
9+
Time Complexity: O(E log V) where E is the number of edges and V is the
1010
number of vertices.
1111
Space Complexity: O(V) to store the graph structures and priority queue.
1212
"""
@@ -47,7 +47,9 @@ def a_star_grid(
4747
grid: list[list[float]],
4848
start: tuple[int, int],
4949
end: tuple[int, int],
50-
heuristic_func: Callable[[tuple[float, float], tuple[float, float]], float] = manhattan_distance,
50+
heuristic_func: Callable[
51+
[tuple[float, float], tuple[float, float]], float
52+
] = manhattan_distance,
5153
) -> list[tuple[int, int]] | None:
5254
"""
5355
Perform A* search on a 2D weighted grid using heapq.
@@ -150,4 +152,4 @@ def a_star_adjacency_list(
150152
if __name__ == "__main__":
151153
import doctest
152154

153-
doctest.testmod()
155+
doctest.testmod()

0 commit comments

Comments
 (0)