Skip to content

Commit 40de1bd

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

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

graphs/a_star.py

Lines changed: 5 additions & 4 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.
@@ -147,8 +149,7 @@ def a_star_adjacency_list(
147149
return None
148150

149151

150-
151152
if __name__ == "__main__":
152153
import doctest
153154

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

0 commit comments

Comments
 (0)