slides - Computer Science - University of San Francisco
slides - Computer Science - University of San Francisco
slides - Computer Science - University of San Francisco
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
17-58: Improving DijkstraCreate a new priority queue, add start nodeWhile the queue is not empty:Remove the vertex v with the smallest distancein the heapIf v is not knownMark v as knownFor each neigbor w <strong>of</strong> v• If distance[w] > distance[v] + cost((v,w))• Set distance[w] = distance[v] +cost((v,w))• Add w to priority queue with prioritydistance[w]