1 / 38

Shortest-Paths Trees

This article discusses the concept of shortest path trees in graphs and how they can be used to find the set of edges that connect all nodes with the minimum total path length. It covers topics such as negative edges in undirected graphs, Dijkstra's algorithm, and the Bellman-Ford algorithm. Examples and step-by-step explanations are provided for better understanding.

Download Presentation

Shortest-Paths Trees

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Shortest-Paths Trees Kun-Mao Chao (趙坤茂) Department of Computer Science and Information Engineering National Taiwan University, Taiwan E-mail: kmchao@csie.ntu.edu.tw WWW: http://www.csie.ntu.edu.tw/~kmchao

  2. Shortest-Paths Trees • The objective is to find the set of edges connecting all nodes such that the sum of the edge lengths from the source to each node is minimized. • In order to minimize the total path lengths, the path from the source to each node must be a shortest path connecting them.

  3. Shortest-Paths Trees(source: vertex a)

  4. Negative edges in an undirected graph

  5. Directed graphs

  6. Dijkstra's Algorithm

  7. Choose a

  8. Relax (a, b) and (a, g)

  9. Choose b; Add (a, b) to T

  10. Relax (b, c) and (b, d)

  11. Choose g; Add (a, g) to T

  12. Relax (g, e) and (g, h)

  13. Choose d; Add (b, d) to T

  14. Relax (d, e)

  15. Choose h; Add (g, h) to T

  16. Choose e; Add (d, e) to T

  17. Relax (e, f)

  18. Choose c; Add (b, c) to T

  19. Relax (c, h)

  20. Choose f; Add (e, f) to T

  21. Relax (f, d) and (f, h)

  22. The resulting SPT

  23. Negative edge

  24. Choose a

  25. Choose b; Add (a, b) to T

  26. Choose d; Add (b, d) to T

  27. Choose c; Add (b, c) to T

  28. Choose e; Add (d, e) to T

  29. Something went wrong

  30. A wrong SPT

  31. A correct SPT

  32. The Bellman-Ford Algorithm

  33. δ[b] and δ[g] modified

  34. δ[c], δ[d], δ[e] and δ[h] modified

  35. δ[f] modified

  36. δ[h] modified

  37. A correct SPT

  38. Try this in class

More Related