09.07.2015 Views

slides - Computer Science - University of San Francisco

slides - Computer Science - University of San Francisco

slides - Computer Science - University of San Francisco

SHOW MORE
SHOW LESS

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]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!