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

A_STAR algorithem Implementation #582

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

Conversation

nagajaideep
Copy link
Contributor

References to other Issues or PRs or Relevant literature

Fixes #486

Brief description of what is fixed or changed

Added A* pathfinding algorithm implementation (_a_star_adjacency_list). This Algorithm uses the Manhattan distance heuristic for coordinate-based nodes and Returns shortest path distance and predecessor dictionary like other pathfinding algorithms

Other comments

used the below to pull requests
https://github.com/codezonediitj/pydatastructs/pull/283/files
https://github.com/codezonediitj/pydatastructs/pull/301/files

@nagajaideep
Copy link
Contributor Author

@Kishan-Ved @czgdp1807
I will be addressing other errors and adding tests for the A* algorithm by this weekend.
Could you please clarify the cause of this error? I have already activated the Conda environment locally? why is it exactly causing it?

https://github.com/codezonediitj/pydatastructs/actions/runs/13481779061/job/37667878320?pr=582#logs

Copy link
Contributor

@Kishan-Ved Kishan-Ved left a comment

Choose a reason for hiding this comment

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

Lines should not end in white spaces.

pred = {v: None for v in graph.vertices}
dist[source] = 0
from pydatastructs.miscellaneous_data_structures.queue import PriorityQueue, BinomialHeapPriorityQueue
pq = PriorityQueue(implementation='binomial_heap')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pq = PriorityQueue(implementation='binomial_heap')
pq = PriorityQueue(implementation='binomial_heap')

pq = PriorityQueue(implementation='binomial_heap')
f_score = heuristic(source, target)
pq.push(source, f_score)
while not pq.is_empty:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
while not pq.is_empty:
while not pq.is_empty:

return dist[target], pred
if visited[current]:
continue
visited[current] = True
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
visited[current] = True
visited[current] = True

visited[current] = True
neighbors = graph.neighbors(current)
if not neighbors:
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
continue
continue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these changes aren't visible in the local development
image
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Kishan-Ved not sure how to resolve this ? shall i git--pull once?

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