advanced algorithms
play

ADVANCED ALGORITHMS 2 LECTURE 10 ANNOUNCEMENTS Homework 2 due - PowerPoint PPT Presentation

1 LECTURE 10: SHORTEST PATH ADVANCED ALGORITHMS 2 LECTURE 10 ANNOUNCEMENTS Homework 2 due next Friday Contacting the TAs: utah-algo-ta@googlegroups.com Notes for this class: http://jeffe.cs.illinois.edu/teaching/algorithms/


  1. � 1 LECTURE 10: SHORTEST PATH ADVANCED ALGORITHMS

  2. � 2 LECTURE 10 ANNOUNCEMENTS ▸ Homework 2 due next Friday ▸ Contacting the TAs: utah-algo-ta@googlegroups.com ▸ Notes for this class: http://jeffe.cs.illinois.edu/teaching/algorithms/ notes/21-sssp.pdf

  3. � 3 LECTURE 10 LAST CLASS if 2 approx for matching ▸ Local search and gradient descent ▸ Shortest path problem

  4. � 4 LECTURE 10 GRAPH ALGORITHMS

  5. � 5 LECTURE 10 SHORTEST PATH PROBLEM Shortest path: given a (possibly directed) graph G = (V, E), and two vertices u, v , find the length of the shortest path from u to v all lengths 1 ▸ What if the graph is not weighted? — breadth first search 01mm ▸ Negative weight edges? Problem is not Fell if u grapmhtfsdes.ve

  6. � 6 LECTURE 10 OU O W BFS + DISTANCE UPDATES? List Ew ▸ Maintain array dist[w] for all vertices w ▸ Initialize using BFS i ▸ For each edge ij , if dist[j] < dist[i] + length(i,j), update dist[j] ▸ Repeat until the dist[] values stop changing dhe w o j w

  7. � 7 LECTURE 10 OBSERVATIONS ▸ At every point of the algorithm, dist[w] is an upper bound on true shortest path length d(u, w) is the true because dist w length of s p to w found ▸ dist[w] is monotone so far Claim: when the algorithm terminates, dist[w] = d(u, w) for all w

  8. � 8 LECTURE 10 Ow of PROOF it Suppose we did k iterations of the algorithm. Is there something nice to be said about dist[w] values? vertices w for a Consider all t o which shortest path from o Ito has lingulate k w u ti a i

  9. � 9 LECTURE 10 Prone claim by induction PROOF (CONTINUED) trivial is k 0 connider htt k Suppose it holds for now hops in shortestpath Ek s't IrmasutEf for all vertices w O we found the path shortest path from u has s t Consider any w ee go htt hops THE affirmed Ittihad correct value ftp.estfwI w

  10. to w has path from Optimum a hops Ek Reach property of Optimal sub structure shortest paths

  11. � 10 LECTURE 10 forT Bellman RUNNING TIME BOUND (SHIMBEL’S ALGORITHM) algorithm aftern iterations claim Previous we have foundthortest w toll paths iterations In for each iteration 0cm Time Overall runtime Of m n we also works when some edge wts are It

  12. � 11 LECTURE 10 BETTER THAN M*N? ▸ Remember, this is an algorithm that also works when there are negative edges ▸ Can we use positivity in a nicer way?

  13. � 12 LECTURE 10 1958 MAIN IDEA — DIJKSTRA’S ALGORITHM Dijkstra ▸ Can we “fix” BFS? ▸ Recall: main idea of BFS — find all vertices at certain distance from u u m x ooo 9K ▸ Problem: in BFS, vertex at distance 2 is nbr of vertex at distance 1

  14. � 13 LECTURE 10 W WI Kes EXTENDING BFS win Intuitiveidas Grow a ball of a certain radius around u a time Add one vertex at Iqq jo vertex with n start formalitalgorithmi min distance tofu that has vertex Add u st l vertex Add u E via it E i via E EE't tou

  15. � 14 LECTURE 10 a data structure that Want PRIORITY QUEUE maintains 6h dist w pair quicklyobtain the is distfw defined w that has minimum dstme value t.be distf via the sitar to the a quickly disowns Of log n in notes Read Offmtn login fm 7 nlognl

  16. � 15 LECTURE 10 CORRECTNESS a vertex to the set we add whenever Claim ball the distt indeed value is maintaining are we to shortest distance n the i

  17. � 16 LECTURE 10 RUNNING TIME

  18. � 17 LECTURE 10 RUNNING TIME

  19. � 18 LECTURE 10 SHORTEST PATHS — SUMMARY ▸ Shimbel/Bellman-Ford algorithm — can handle negative weights, but is slower ▸ Dijkstra’s algorithm — (m+n) log n ▸ Don’t know if log n is necessary!

Recommend


More recommend