Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented A* algorithm and updated test cases #576

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nagajaideep
Copy link
Contributor

@nagajaideep nagajaideep commented Jan 16, 2025

References to other Issues or PRs or Relevant literature

fixes #486
https://github.com/codezonediitj/pydatastructs/pull/283/files
https://github.com/codezonediitj/pydatastructs/pull/301/files

Brief description of what is fixed or changed

1.implemented a star algorithm with the help of Manhattan heustric and took reference from the Wikipedia
2.took reference from the Dijkstra and bellman ford algorithm for test cases and code writing

Other comments

@nagajaideep nagajaideep deleted the Astar branch January 16, 2025 15:44
@nagajaideep nagajaideep restored the Astar branch January 16, 2025 16:30
@nagajaideep nagajaideep reopened this Jan 16, 2025
@nagajaideep
Copy link
Contributor Author

@Kishan-Ved @czgdp1807
image
this issue in the terminal isn't a changed by me but it's about an import error .any idea on how to resolve this?

Comment on lines +756 to +762
if algorithm == 'a_star_with_manhattan':
# A* with this implementation requires both source and target
if not target:
raise ValueError("Target must be specified for A* algorithm")

func = "_a_star_with_manhattan_" + graph._impl
return getattr(algorithms, func)(graph, source, target)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. The logic below already handles this.

@@ -293,7 +292,34 @@ def _test_shortest_paths_positive_edges(ds, algorithm):
graph.remove_edge('SLC', 'D')
graph.add_edge('D', 'SLC', -10)
assert raises(ValueError, lambda: shortest_paths(graph, 'bellman_ford', 'SLC'))

def _test_a_star_manhattan(ds):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _test_a_star_manhattan(ds):
def _test_a_star_manhattan(ds):

@czgdp1807
Copy link
Member

this issue in the terminal isn't a changed by me but it's about an import error .any idea on how to resolve this?

It's a path setting issue in VSCode. You need to add PATH to your conda environment headers in VSCode settings.

@nagajaideep
Copy link
Contributor Author

I'm currently working on this along with publishing a research paper. I'll get it done ASAP sir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A* Algorithm
2 participants