Before revision: Pseudocode This code assumes a priority queue queue, which supports the following operations: topKey() returns the lowest priority of any node in the queue (or infinity if the queue is empty) pop() removes the node with the lowest priority from the queue and returns it insert(node, priority) inserts a node with a given priority into the queue remove(node) removes a node from the queue contains(node) returns true if the queue contains the specified node, false if not void main() { initialize(); while (true) { computeShortestPath(); while (!hasCostChanges()) sleep; for (edge : getChangedEdges()) { edge.setCost(getNewCost(edge)); updateNode(edge.endNode); } } } void initialize() { queue = new PriorityQueue(); for (node : getAllNodes()) { node.g = INFINITY; node.rhs = INFINITY; } start.rhs = 0; queue.insert(start, calculateKey(start)); } /** Expands the nodes in the priority queue.
After revision: (numerically)Pseudocode This code assumes a priority queue queue, which supports the following operations: topKey() returns the lowest priority of any node in the queue (or infinity if the queue is empty) pop() removes the node with the lowest priority from the queue and returns it insert(node, priority) inserts a node with a given priority into the queue remove(node) removes a node from the queue contains(node) returns true if the queue contains the specified node, false if not void main() { initialize(); while (true) { computeShortestPath(); while (!hasCostChanges()) sleep; for (edge : getChangedEdges()) { edge.setCost(getNewCost(edge)); updateNode(edge.endNode); } } } void initialize() { queue = new PriorityQueue(); for (node : getAllNodes()) { node.g = INFINITY; node.rhs = INFINITY; } start.rhs = 0; queue.insert(start, calculateKey(start)); } /** Expands the nodes in the priority queue.