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

Less initializations in A* algorithms by implementing modified priority queue #18

Open
dominicparga opened this issue Oct 25, 2016 · 0 comments

Comments

@dominicparga
Copy link
Collaborator

dominicparga commented Oct 25, 2016

For now, we initialize a new weighted node in the A* algorithms for each leaving edge and put it in the priority queue, although it is already in the queue. This implementation is no problem regarding functionality (you just need the node with less weight), but it needs unused memory in case your nodes are weighted multiple times.

Solution: A priority queue with complexity o(n) (less than linear!) for contains could remove an existing node fast. Returning it, modifying and putting it back to the queue in O(logn) would do the same functionality without a new initialization. contains in o(n) could be done by using a hash map mapping an element on its position in the queue.

@dominicparga dominicparga added this to the Routing: optimization without new algorithms milestone Oct 25, 2016
@dominicparga dominicparga reopened this Dec 23, 2016
@dominicparga dominicparga removed this from the Routing: optimization without new algorithms milestone Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants