# Breadth-First Search and Shortest Path Kevin Schaffer Chapter 15.4 from “Distributed Algorithms” by Nancy A. Lynch.

## Presentation on theme: "Breadth-First Search and Shortest Path Kevin Schaffer Chapter 15.4 from “Distributed Algorithms” by Nancy A. Lynch."— Presentation transcript:

Breadth-First Search and Shortest Path Kevin Schaffer Chapter 15.4 from “Distributed Algorithms” by Nancy A. Lynch

Outline Breadth-First Search  AsynchBFS  LayeredBFS  HybridBFS Shortest Path  AsynchBellmanFord

AsynchBFS Similar to AsynchSpanningTree AsynchSpanningTree algorithm does not always generate a breadth-first spanning tree AsynchBFS detects incorrect parent assignments and corrects them

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.

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

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

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

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)

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

AsynchBellmanFord Generates a shortest path tree rooted at i 0 Similar to AsynchBFS but sends weighted distances Same problem with termination as AsynchBFS

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))

Download ppt "Breadth-First Search and Shortest Path Kevin Schaffer Chapter 15.4 from “Distributed Algorithms” by Nancy A. Lynch."

Similar presentations