Distributed Algorithms Broadcast and spanning tree.

Slides:



Advertisements
Similar presentations
Chapter 5: Tree Constructions
Advertisements

Communication Networks Recitation 3 Bridges & Spanning trees.
Lecture 8: Asynchronous Network Algorithms
Chapter 4 Distributed Bellman-Ford Routing
Chapter 15 Basic Asynchronous Network Algorithms
Self Stabilizing Algorithms for Topology Management Presentation: Deniz Çokuslu.
Lecture 7: Synchronous Network Algorithms
1 Dijkstra’s Minimum-Path Algorithm Minimum Spanning Tree CSE Lectures 20 – Intro to Graphs.
Breadth-First Search and Shortest Path Kevin Schaffer Chapter 15.4 from “Distributed Algorithms” by Nancy A. Lynch.
Graph Traversals Visit vertices of a graph G to determine some property: Is G connected? Is there a path from vertex a to vertex b? Does G have a cycle?
Graph Traversals Visit vertices of a graph G to determine some property: Is G connected? Is there a path from vertex a to vertex b? Does G have a cycle?
Minimum Spanning Trees
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Self Stabilization 1.
1 Complexity of Network Synchronization Raeda Naamnieh.
Chapter 5 Routing Algorithm in Networks. How are message routed from origin to destination? 1) Circuit-Switching → telephone net. Dedicated bandwidth.
CPSC 668Set 2: Basic Graph Algorithms1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
Network Layer4-1 Spanning trees r Suppose you have a connected undirected graph m Connected: every node is reachable from every other node m Undirected:
LSRP: Local Stabilization in Shortest Path Routing Hongwei Zhang and Anish Arora Presented by Aviv Zohar.
Routing So how does the network layer do its business?
CPSC 668Self Stabilization1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
TCOM 501: Networking Theory & Fundamentals
Chapter 11 Detecting Termination and Deadlocks. Motivation – Diffusing computation Started by a special process, the environment environment sends messages.
Tirgul 13. Unweighted Graphs Wishful Thinking – you decide to go to work on your sun-tan in ‘ Hatzuk ’ beach in Tel-Aviv. Therefore, you take your swimming.
1 Internet Networking Spring 2006 Tutorial 3 Ad-hoc networks TBRPF (based on IETF tutorials on TBRPF)
More Graph Algorithms Weiss ch Exercise: MST idea from yesterday Alternative minimum spanning tree algorithm idea Idea: Look at smallest edge not.
Tirgul 7 Review of graphs Graph algorithms: – BFS (next tirgul) – DFS – Properties of DFS – Topological sort.
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
1 Shortest Path Algorithms. 2 Routing Algorithms Shortest path routing What is a shortest path? –Minimum number of hops? –Minimum distance? There is a.
ROUTING ON THE INTERNET COSC Aug-15. Routing Protocols  routers receive and forward packets  make decisions based on knowledge of topology.
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
Complexity of Bellman-Ford Theorem. The message complexity of Bellman-Ford algorithm is exponential. Proof outline. Consider a topology with an even number.
1 GRAPHS - ADVANCED APPLICATIONS Minimim Spanning Trees Shortest Path Transitive Closure.
Broadcast & Convergecast Downcast & Upcast
Distributed Computing 5. Synchronization Shmuel Zaks ©
1 Pertemuan 20 Teknik Routing Matakuliah: H0174/Jaringan Komputer Tahun: 2006 Versi: 1/0.
Graph (II) Shortest path, Minimum spanning tree GGuy
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 10 Instructor: Haifeng YU.
TCP Traffic and Congestion Control in ATM Networks
Network and Communications Ju Wang Chapter 5 Routing Algorithm Adopted from Choi’s notes Virginia Commonwealth University.
Network Layer4-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet.
Complexity of Bellman-Ford
1 Broadcast. 2 3 Use a spanning tree Root 4 synchronous It takes the same time at link to send a message It takes the same time at each node to process.
Termination Detection
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
A correction The definition of knot in page 147 is not correct. The correct definition is: A knot in a directed graph is a subgraph with the property that.
10 Copyright © William C. Cheng Data Structures - CSCI 102 Graph Terminology A graph consists of a set of Vertices and a set of Edges C A B D a c b d e.
Data Structures & Algorithms Shortest Paths Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
DISTRIBUTED ALGORITHMS Spring 2014 Prof. Jennifer Welch Set 2: Basic Graph Algorithms 1.
Tree Constructions Distributed Algorithms for Multi-Agent Networks Instructor: K. Sinan YILDIRIM.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
Graph Algorithms Why graph algorithms ? It is not a “graph theory” course! Many problems in networks can be modeled as graph problems. Note that -The topology.
CIS 825 Review session. P1: Assume that processes are arranged in a ring topology. Consider the following modification of the Lamport’s mutual exclusion.
Graphs + Shortest Paths David Kauchak cs302 Spring 2013.
CSE 421 Computer Networks. Network Layer 4-2 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside.
CSC317 1 At the same time: Breadth-first search tree: If node v is discovered after u then edge uv is added to the tree. We say that u is a predecessor.
2016/7/2Appendices A and B1 Introduction to Distributed Algorithm Appendix A: Pseudocode Conventions Appendix B: Graphs and Networks Teacher: Chun-Yuan.
1 Traversal Algorithms  sequential polling algorithm  traversing connected networks (tree construction) complexity measures tree terminology tarry’s.
(How the routers’ tables are filled in)
Minimum Spanning Trees
Multi-Node Broadcasting in Hypercube and Star Graphs
Intra-Domain Routing Jacob Strauss September 14, 2006.
Tree Construction (BFS, DFS, MST) Chapter 5
CS 3700 Networks and Distributed Systems
CS 3700 Networks and Distributed Systems
Lecture 8: Synchronous Network Algorithms
The Bellman-Ford Shortest Path Algorithm Neil Tang 03/27/2008
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Weighted Graphs & Shortest Paths
Dynamic Routing Protocols part3 B
Synchronizers Outline motivation principles and definitions
Presentation transcript:

Distributed Algorithms Broadcast and spanning tree

Model  Node Information:  Adjacent links  Neighboring nodes.  Unique identity.  Graph model: undirected graph.  Nodes V  Edges E  Diameter D

Model Definition  Synchronous Model:  There is a global clock.  Packet can be sent only at clock ticks.  Packet sent at time t is received by t+1.  Asynchronous model:  Packet sent is eventually received.

Complexity Measures  Message complexity:  Number of messages sent (worst case).  Usually assume “small messages”.  Time complexity  Synchronous Model: number of clock ticks  Asynchronous Model: Assign delay to each message in (0,1]. Worse case over possible delays

Problems  Broadcast - Single initiator:  The initiator has an information.  At the end of the protocol all nodes receive the information  Example : Topology update.  Spanning Tree:  Single/Many initiators.  On termination there is a spanning tree.  BFS tree:  A minimum distance tree with respect to the originator.

Basic Flooding: Algorithm  Initiator:  Initially send a packet p(info) to all neighbors.  Every node:  When receiving a packet p(info): Sends a packet p(info) to all neighbors.

Basic Flooding: Example

Basic Flooding: Correctness  Correctness Proof:  By induction on the distance d from initiator. Basis d=0 trivial.  Induction step: Consider a node v at distance d. Its neighbor u of distance d-1 received the info. Therefore u sends a packet p(info) to all neighbors (including v). Eventually v receives p(info).

Basic Flooding: Complexity  Time Complexity  Synchronous (and asynchronous): Node at distance d receives the info by time d.  Message complexity:  There is no termination!  Message complexity is unbounded!  How can we correct this?

Basic Flooding: Improved  Each node v has a bit sent[v], initially sent[v]=FALSE.  Initiator:  Initially: Send packet p(info) to all neighbors and set sent[initiator]=TRUE.  Every node v:  When receiving a packet p(info) from u: IF sent[v]=FALSE THEN Send packet p(info) to all neighbors.

Basic Flooding: Improved  Message Complexity:  Each node sends once on each edge!  Number of messages equals to 2|E|.  Time complexity:  Diameter D.  Drawbacks  Termination detection

Spanning tree  Goal:  At the end of the protocol have a spanning tree  Motivation for building spanning tree:  Construction costs O(|E|).  Broadcast on tree: only |V|-1 messages.

Spanning tree: Algorithm  Data Structure:  Add to each node v a variable father[v].  Initially: father[v] = null.  Each node v:  When receiving packet p(info) from u and father[v]= null  THEN Set father [v]=u.

Spanning Tree : Example

Spanning tree Algorithm: Correctness  Correctness Proof:  Every node v (except the initiator) sets father[v].  There are no cycles.  Is it a shortest path tree?  Synchronous  Asynchronous

Flood with Termination  Motivation: Inform Initiator of termination.  Initiator:  Initially: Send packet p(info) to all neighbors and set set[initiator]=True  Non-Initiator node w :  When receiving a packet p(info) from u: IF sent[w]=FALSE –THEN father[w]=u ; send packet p(info) to all neighbors (except u). –ELSE Send Ack to u.  After receiving Ack from all neighbors except father[w]: Send Ack to father[w].

Flood with Termination: Correctness  Tree Construction: Proof as before.  Termination:  By induction on the distance from the leaves of the tree.  Basis d=0 (v is a leaf). Receives immediately Ack on all packets (except father[v] ). Sends Ack packet to father[v].  Induction step: All nodes at distance d-1 received and sent Ack. Nodes at distance d will eventually receive Ack, and eventually will send Ack.

DFS Tree  Data Structure in node v:  Edge-status[v,u] for each neighbor u.  Possible values are {NEW,SENT, Done}. Initially status[v,u]=NEW.  Node-status[v].  Possible Values {New, Visited, Terminated} Initially: Node-Status[v]=NEW (except the Initiator which have Node-Status[initiator]=Visited).  Parent[v]: Initially Parent[v]=Null  Packets type:  Token : traversing edges.

DFS: Algorithm  Token arrives at a node v from u:  Node_Status[v]=Visited & Edge_Status[v,u]=NEW Edge_Status[v,u]=Done ; Send token to u.  Node_Status[v]=Visited & Edge_Status[v,u]=Sent Edge_Status[v,u]=Done. (*) IF for some w: Edge_Status[v,w]=New THEN –Edge_Status[v,w]=Sent ; Send token to w. –ELSE Node_Status=Terminated ; send token to parent[v]. [If v is the initiator then DFS terminates]  Node_Status[v]=New Parent[v]=u; Node_Status[v]=Visited; Edge_Status[u,v]=Sent [Same as Node_Status[v]=Visited from (*)]

DFS : Example

DFS Tree: Performance  Correctness:  There is only one packet in transit at any time.  On each edge one packet is sent in each direction.  The parent relationship creates a DFS tree.  Complexity:  Messages: 2|E|  Time: 2|E|  How can we improve the time to O(|V|).

Spanning Tree: BFS  Synchronous model: have seen.  Asynchronous model:  Distributed Bellman-Ford  Distributed Dijkstra

BFS: Bellman-Ford  Data structure:  Each node v has a variable level[v].  Initially level[initiator]=0 at the initiator and level[v]=  at any other node v.  Variable parent, initialized at every node v to parent[v] = null.  Packet types:  layer(d) : there is a path of length at most d to the initiator.

BFS: Bellman-Ford Algorithm  Initiator:  Send packet layer(0) to all neighbors.  Every node v:  When receiving packet layer(d) from w  IF d+1 < level[v] THEN Parent[v]=w Level[v]=d+1 Send layer(d+1) to all neighbors (except w).

BFS: Bellman-Ford Correctness  Correctness Proof:  Termination: Each node u updates level[u] at most |V| times.  Relationship parent creates a tree  After termination: if parent[u]=w then level[u]=level[w]+1 [BSF Tree]  Complexity  Time: O(Diameter)  Messages: O(Diameter*|E|)

BFS: Bellman-Ford Example

Bellman Ford: Multiple initiators  Set distance (id-initiator,d).  Use Lexicographic ordering.  Each node can change level at most  Number of initiators * |V|  At most |V| 2

BSF: Dijkstra Illustrated 1k k+1

BFS: Dijkstra  Asynchronous model:  Advance one level at a time.  Go back to root after adding each level.  Time = O( D 2 )  Messages = O( |E| + D * |V| ) D=Diameter

BFS: Dijkstra  Data Structures:  Father[v]: the identity of the father of v.  Child[v,u]: u is a child of v in the tree.  Up[v,u]: u is closer to the initiator than v.  Packets  Pulse  forward  Father  Ack.

BFS: Dijkstra  In phase k:  Initiator sends a packet Pulse to its children.  Every node of the tree that receives a packet Pulse sends a packet Pulse to its children.  Every leaf v of the tree: Sends a packet forward to all neighbors w s.t. up[v,w]=FALSE. When receiving packet father[u] from u set child[v,u]=TRUE. When receiving either Ack or father[w] from all neighbors w with up[v,w]=FALSE : send Ack to father[v].  Every internal node v that receives Ack from all its children send Ack to its father father[v].

BFS: Dijkstra  A node u that receives a forward packet (from v):  First forward packet: Sets father[u]=v Sends father[u] to node v.  second (or more) forward packet: Send Ack to v.

BFS: Dijkstra  End of phase k:  Initiator receives Ack from all its children.  Initiator start phase k+1.  Termination:  If no new node is reached in last phase.

BFS: Dijkstra  Correctness:  Induction on the phases  Asynchronous model.  Time = O( D 2 )  Messages = O( |E| + D * |V| )  D=Diameter

Conclusion  Broadcast:  Flooding  Flooding with termination  Spanning tree  Unstructured spanning tree (using flooding)  DFS Tree  BFS Tree