Jump to content
  • Advertisement
Sign in to follow this  
Carolina

Shortest path algorithm with linked list

This topic is 4804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!Here I am again,in trouble as always XD My mission is to implement a version of Dijkstra´s Algorithm(that finds the shortest path between two points) using a Linked List instead of the commom matrix of distance values. I only want to know how any of you would implement the "relaxation" part of the algorithm(that part in which it is made a comparison between a vector of distances D and a matrix of values input by the user). Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
I really wouldn't implement it using a linked list. A hash-map from node ID to cost, or a vector (or a vector of vector) maybe, but never a linked list. Finding the right node to update would be O(N) and would cache poorly (because each node can be a new cache line).

Share this post


Link to post
Share on other sites
Well,I wouldn´t implement it using a linked list either,but my teacher is nuts and he wants it delivered today!Whoa,I´m such a lucky student XD

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!