Sign in to follow this  
ITGER

Question about Dijkstra's algorithm

Recommended Posts

ITGER    163
Hi, I'm trying to implement Dijkstra's algorithm for pathfinding through a graph of waypoints. My question is, is the order in which you "visit" nodes (pop them out of the priority queue" the same order as the shortest path? This is what I am assuming right now. Whenever I pop a waypoint from the priority queue, I place its waypoint ID number into a separate queue. When I'm done, I have a queue filled with waypoint IDs, from which I can recover positions for my bot to get to. However, the bot is not obeying the graph edges for some reason! If it sets a goal on the other side of the map, it flies (this is a space shooter) straight to it, unconditionally. Have I assumed something incorrectly? I'm pretty sure that I'm at least handling the waypoint ID's correctly - I push and pop from the queue's front... Let me know if you want to see some code. (There's quite a bit of it I think.) Thanks. :Edit: Oops..errr yeah that's definitely wrong. Nevermind. [Edited by - ITGER on March 26, 2005 5:31:15 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this