Skip to content

Commit b9dcaef

Browse files
committed
added algorithm.lower() to resolve the error
1 parent e198a50 commit b9dcaef

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pydatastructs/graphs/algorithms.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ def shortest_paths(graph: Graph, algorithm: str,
744744
>>> G2 = Graph(start, middle, goal)
745745
>>> G2.add_edge('0,0', '1,1', 2)
746746
>>> G2.add_edge('1,1', '2,2', 2)
747-
>>> shortest_paths(G2, 'A_star', '0,0', '2,2')
747+
>>> shortest_paths(G2, 'a_star', '0,0', '2,2')
748748
(4, {'0,0': None, '1,1': '0,0', '2,2': '1,1'})
749749
References
750750
==========
@@ -756,7 +756,7 @@ def shortest_paths(graph: Graph, algorithm: str,
756756
raise_if_backend_is_not_python(
757757
shortest_paths, kwargs.get('backend', Backend.PYTHON))
758758
import pydatastructs.graphs.algorithms as algorithms
759-
func = "_" + algorithm + "_" + graph._impl
759+
func = "_" + algorithm.lower() + "_" + graph._impl
760760
if not hasattr(algorithms, func):
761761
raise NotImplementedError(
762762
"Currently %s algorithm isn't implemented for "
@@ -824,7 +824,6 @@ def _dijkstra_adjacency_list(graph: Graph, start: str, target: str):
824824
def _a_star_adjacency_list(graph: Graph, source: str, target: str) -> tuple:
825825
"""
826826
A* pathfinding algorithm implementation similar to Dijkstra's structure.
827-
828827
Parameters
829828
==========
830829
graph: Graph
@@ -833,7 +832,6 @@ def _a_star_adjacency_list(graph: Graph, source: str, target: str) -> tuple:
833832
Starting node name
834833
target: str
835834
Target node name
836-
837835
Returns
838836
=======
839837
(distance, predecessors): tuple

0 commit comments

Comments
 (0)