Download presentation
Presentation is loading. Please wait.
Published byAshley Montgomery Modified over 9 years ago
1
Breadth-First Search and Shortest Path Kevin Schaffer Chapter 15.4 from “Distributed Algorithms” by Nancy A. Lynch
2
Outline Breadth-First Search AsynchBFS LayeredBFS HybridBFS Shortest Path AsynchBellmanFord
3
AsynchBFS Similar to AsynchSpanningTree AsynchSpanningTree algorithm does not always generate a breadth-first spanning tree AsynchBFS detects incorrect parent assignments and corrects them
4
Safety and Liveness Safety For every process i i 0, dist i is the length of some path p from i 0 to i in G in which the predecessor of i is parent i. For every message m in channel C i,j, m is the length of some path p from i 0 to i. Liveness For every pair of neighbors i and j, either dist j dist i + 1, or else either send(j) i or C i,j contains the value dist i.
5
Complexity of AsynchBFS Message complexity: O(n|E|) A node can receive at most n estimates, each of which generates |E| messages Time complexity: O(diam n(l + d)) Length of the shortest path from i 0 to any node is diam and at most n messages are ever in any channel
6
Termination in AsynchBFS Problem with AsynchBFS: Processes do not know when to terminate Solution: Modify algorithm to perform a convergecast/broadcast at the end Not as straight-forward as AsynchBcastAck since processes may participate multiple times
7
LayeredBFS Constructs the BFS tree in phases Each phase adds one layer to the tree; layer k contains the nodes at depth k in the tree Upon completion of phase k, all processes with depth at most k know their parent and those at depth at most k – 1 know their children Acknowledgements let i 0 know when each phase is complete
8
Complexity of LayeredBFS Message complexity: O(|E| + n diam) At most |E| search and acknowledgements At most diam + 1 phases At most n newphase/convergecast messages Time complexity: O(diam 2 (l + d)) Each phase takes diam(l + d)
9
HybridBFS HybridBFS performs an AsynchBFS multiple times, completing m layers during each phase If m = 1 then HybridBFS is similar to LayeredBFS and if m = diam then HybridBFS is similar to AsynchBFS
10
AsynchBellmanFord Generates a shortest path tree rooted at i 0 Similar to AsynchBFS but sends weighted distances Same problem with termination as AsynchBFS
11
Complexity of ABF Worst-case is exponential Message complexity: O(n n |E|) Maximum number of distinct simple paths Time complexity: O(n n + 1 (l + d))
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.