Skip to content

Commit e31ba9c

Browse files
committed
feat: add graph algorithem
1 parent f3fd195 commit e31ba9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pydatastructs/graphs/algorithms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ def _a_star_adjacency_list(graph: Graph, source: str, target: str) -> tuple:
797797

798798
from pydatastructs.miscellaneous_data_structures.queue import PriorityQueue
799799
pq = PriorityQueue(implementation='binomial_heap')
800-
pq.push(source, 0)
800+
pq.push(source, distances[source] + heuristic(source, target)) # Fixed push
801801

802802
def heuristic(node: str, goal: str) -> float:
803803
try:
@@ -828,7 +828,7 @@ def heuristic(node: str, goal: str) -> float:
828828

829829
return (distances, predecessor)
830830

831-
_a_star_adjacency_matrix = _a_star_adjacency_list
831+
_a_star_adjacency_matrix = _a_star_adjacency_list # Ensure matrix version exists
832832

833833
def all_pair_shortest_paths(graph: Graph, algorithm: str,
834834
**kwargs) -> tuple:

0 commit comments

Comments
 (0)