Graph Algorithms Many problems in networks can be modeled as graph problems. -The topology of a distributed system is a graph. - Routing table computation.

Slides:



Advertisements
Similar presentations
CSCI-1680 Network Layer: Intra-domain Routing Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti Rodrigo Fonseca.
Advertisements

Chapter 5: Tree Constructions
Ion Stoica, Robert Morris, David Karger, M. Frans Kaashoek, Hari Balakrishnan MIT and Berkeley presented by Daniel Figueiredo Chord: A Scalable Peer-to-peer.
Peer to Peer and Distributed Hash Tables
COS 461 Fall 1997 Routing COS 461 Fall 1997 Typical Structure.
The Chord P2P Network Some slides have been borowed from the original presentation by the authors.
Courtesy: Nick McKeown, Stanford
Common approach 1. Define space: assign random ID (160-bit) to each node and key 2. Define a metric topology in this space,  that is, the space of keys.
Global State Collection. Global state collection Some applications - computing network topology - termination detection - deadlock detection Chandy-Lamport.
Peer to Peer File Sharing Huseyin Ozgur TAN. What is Peer-to-Peer?  Every node is designed to(but may not by user choice) provide some service that helps.
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 22 Introduction to Computer Networks.
Topics in Reliable Distributed Systems Fall Dr. Idit Keidar.
Spring Routing & Switching Umar Kalim Dept. of Communication Systems Engineering 06/04/2007.
1 Computer Networks Routing Algorithms. 2 IP Packet Delivery Two Processes are required to accomplish IP packet delivery: –Routing discovering and selecting.
MULTICASTING Network Security.
P2P Course, Structured systems 1 Skip Net (9/11/05)
Lecture 16 Distributed Graph (Routing) Algorithms Source: (1) Book “Distributed Systems: an Algorithmic Approach”, S. Gosh, Chapter “Graph.
Interval Routing Presented by: Marc Segal. Motivation(1) In a computer network a routing method is required so that nodes can communicate with each other.
Delivery, Forwarding and
Routing Algorithms (Ch5 of Computer Network by A. Tanenbaum)
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.
Network Layer (3). Node lookup in p2p networks Section in the textbook. In a p2p network, each node may provide some kind of service for other.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
1 Computer Communication & Networks Lecture 22 Network Layer: Delivery, Forwarding, Routing (contd.)
Spring 2008CS 3321 Intradomain Routing Outline Algorithms Scalability.
Routing Protocols RIP, OSPF, BGP. A Routing Protocol’s Job Is to Find a “Best” Path between Any Pair of Nodes Routers in a network exchange their routing.
WAN technologies and routing Packet switches and store and forward Hierarchical addresses, routing and routing tables Routing table computation Example.
Graph Algorithms Many problems in networks can be modeled as graph problems. -The topology of a distributed system is a graph. - Routing table computation.
Minimum Spanning Tree Given a weighted graph G = (V, E), generate a spanning tree T = (V, E’) such that the sum of the weights of all the edges is minimum.
1 Reading Report 5 Yin Chen 2 Mar 2004 Reference: Chord: A Scalable Peer-To-Peer Lookup Service for Internet Applications, Ion Stoica, Robert Morris, david.
Chord: A Scalable Peer-to-peer Lookup Protocol for Internet Applications Xiaozhou Li COS 461: Computer Networks (precept 04/06/12) Princeton University.
10.- Graph Algorithms Centro de Investigación y Estudios Avanzados del Instituto Politécnico Nacional Introduction Routing Algorithms Computation of Shortest.
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.
Chapter 22 Network Layer: Delivery, Forwarding, and Routing Part 5 Multicasting protocol.
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Chapter 5 Network Layer.
Content Addressable Network CAN. The CAN is essentially a distributed Internet-scale hash table that maps file names to their location in the network.
Data Communications and Networking Chapter 11 Routing in Switched Networks References: Book Chapters 12.1, 12.3 Data and Computer Communications, 8th edition.
Complexity of Bellman-Ford
SIGCOMM 2001 Lecture slides by Dr. Yingwu Zhu Chord: A Scalable Peer-to-peer Lookup Service for Internet Applications.
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.
Spring 2006CS 3321 Intradomain Routing Outline Algorithms Scalability.
1 Computer Communication & Networks Lecture 21 Network Layer: Delivery, Forwarding, Routing Waleed.
Hwajung Lee. Why graph algorithms ? It is not a “graph theory” course! Many problems in networks can be modeled as graph problems. Note that -The topology.
1. Outline  Introduction  Different Mechanisms Broadcasting Multicasting Forward Pointers Home-based approach Distributed Hash Tables Hierarchical approaches.
Idit Keidar, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Lecture 2: Distributed Hash.
Routing protocols. Static Routing Routes to destinations are set up manually Route may be up or down but static routes will remain in the routing tables.
LOOKING UP DATA IN P2P SYSTEMS Hari Balakrishnan M. Frans Kaashoek David Karger Robert Morris Ion Stoica MIT LCS.
Computer Networks22-1 Network Layer Delivery, Forwarding, and Routing.
2/14/2016  A. Orda, A. Segall, 1 Queueing Networks M nodes external arrival rate (Poisson) service rate in each node (exponential) upon service completion.
Spring 2000CS 4611 Routing Outline Algorithms Scalability.
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.
Spring Routing: Part I Section 4.2 Outline Algorithms Scalability.
CS 6401 Intra-domain Routing Outline Introduction to Routing Distance Vector Algorithm.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
Incrementally Improving Lookup Latency in Distributed Hash Table Systems Hui Zhang 1, Ashish Goel 2, Ramesh Govindan 1 1 University of Southern California.
ECE 544 Protocol Design Project 2016 Nirali Shah Thara Philipson Nithin Raju Chandy.
Chord: A Scalable Peer-to-Peer Lookup Service for Internet Applications * CS587x Lecture Department of Computer Science Iowa State University *I. Stoica,
The Chord P2P Network Some slides taken from the original presentation by the authors.
Network Layer.
Dynamic Routing Protocols II OSPF
The Chord P2P Network Some slides have been borrowed from the original presentation by the authors.
Intra-Domain Routing Jacob Strauss September 14, 2006.
Routing: Distance Vector Algorithm
5.2 FLAT NAMING.
CS 3700 Networks and Distributed Systems
Intradomain Routing Outline Introduction to Routing
CS 3700 Networks and Distributed Systems
Network Layer.
Presentation transcript:

Graph Algorithms Many problems in networks can be modeled as graph problems. -The topology of a distributed system is a graph. - Routing table computation uses the shortest path algorithm - Efficient broadcasting uses a spanning tree of a graph - maxflow algorithm determines the maximum flow between a pair of nodes in a graph, etc etc.

Routing Shortest path routing Distance vector routing Link state routing Routing in sensor networks Routing in peer-to-peer networks

Internet routing Autonomous System AS0 AS1 AS2AS3 Intra-AS vs. Inter-AS routing Each belongs to a single administrative domain Open Shortest Path First (OSPF) is an adaptive routing protocol for Internet Protocol (IP) network

Routing: Shortest Path Classical algorithms like Bellman-Ford, Dijkstra’s algorithm are found in most algorithm books. In an ( ordinary ) graph algorithm the entire graph is visible In a distributed graph algorithm only one node and its neighbors are visible

Routing: Shortest Path Most distributed algorithms for shortest path are adaptations of Bellman-Ford algorithm. It computes single-source shortest paths in a weighted graphs. Designed for directed graphs. Computes shortest path if there are no cycle of negative weight. Let D(j) = shortest distance of node j from initiator 0. D(0) = 0. Initially, ∀ i ≠ 0, D(i) =∞. Let w(i, j) = weight of the edge from node i to node j 0 j k w(0,m),0 (w(0,j)+w(j,k)), j The edge weights can represent latency or distance or some other appropriate parameter. m initiator (w(0,j), 0 (w(0,j)+w(j,p)), j p Parent relation Sender’s id

Shortest path Revisiting Bellman Ford adaptation : Consider a static topology {Process 0 sends w(0,i),0 to each neighbor i} {program for process i} do message = (S,k)  S < D(i)  if parent ≠ k  parent := k fi; D(i) := S; send (D(i)+w(i,j),i) to each neighbor j ≠ parent; [] message (S,k)  S ≥ D(i) --> skip od Computes the shortest distance from all nodes to the initiator node The parent links help the packets navigate to the initiator Current distance

Complexity of Bellman-Ford Theorem. The message complexity of Bellman-Ford algorithm is exponential. Proof outline. Consider a topology with an even number nodes 0 through n-1 (the unmarked edges have weight 0) k k2k 0 n n-3n n-4n-2 Time the arrival of the signals so that D(n-1) reduces from (2 k+1 - 1) to 0 in steps of 1. Since k = (n-1)/2, it will need 2 (n+1)/2 -1 messages to reach the goal. So, the message complexity is exponential.

Shortest path Chandy & Misra’s algorithm : basic idea (includes termination detection) Process 0 sends w(0,i),0 to each neighbor i {for process i > 0} do message = (S,k)  S < D  if parent ≠ k  send ack to parent fi; parent := k; D := S; send (D + w(i,j), i) to each neighbor j ≠ parent; deficit := deficit + |N(i)| -1 [] message (S,k)  S ≥ D  send ack to sender [] ack  deficit := deficit – 1 []deficit = 0  parent  i  send ack to parent od Combines shortest path computation with termination detection. Termination is detected when the initiator receives ack from each neighbor

Shortest path An important issue is: how well do such algorithms perform when the topology changes? No real network is static! Let us examine distance vector routing that is adaptation of the shortest path algorithm

Distance Vector Routing Distance Vector D for each node i contains N elements D[i,0], D[i,1], D[i,2] … D[i, N-1]. D[i,j] denotes the distance from node i to node j. ∀ i, D[i,i] =0, and initially ∀ i,j: i≠j, D[i,j] = ∞. - Each node j periodically sends its distance vector to its immediate neighbors. - Every neighbor i of j, after receiving the broadcasts from its neighbors, updates its distance vector as follows:  k ≠ i: D[i,k] = min k (w[i,j] + D[j,k] ) Used in RIP, IGRP etc j i k D[j,k] w[i,j] D[i,k]

What if the topology changes? Assume that each edge has weight = 1. Currently, Node 1: d(1,0) = 1, d(1, 2) = 1, d(1,2 = 2 Node 2: d(2,0) = 1, d(2,1) =1, d(2,3) = 1 Node 1: d(3,0) = 2, d(3,1) = 2, d(3,2) = 1 Observe what can happen when the link (2,3) fails.

Counting to infinity Node 1 thinks d(1,3) = 2 (old value) Node 2 thinks d(2,3) = d(1,3) +1 = 3 Node 1 thinks d(1,3) = d(2,3) +1 = 4 and so on. So it will take forever for the distances to stabilize. A partial remedy is the split horizon method that will prevent node 1 from sending the advertisement about d(1,3) to 2 since its first hop (to 3) is node 2 Observe what can happen when the link (2,3) fails.  k≠ i: D[i,k] = min k (w[i,j] + D[j,k] ) Suitable for smaller networks. Larger volume of data is disseminated, but to its immediate neighbors only. Poor convergence property D[j,k]=3 means j thinks k is 3 hops away

Link State Routing Each node i periodically broadcasts the weights of all edges (i,j) incident on it (this is the link state ) to all its neighbors. The mechanism for dissemination is flooding. This helps each node eventually compute the topology of the network, and independently determine the shortest path to any destination node using some standard graph algorithm like Dijkstra’s. Smaller volume data disseminated over the entire network Used in OSPF of IP

Link State Routing Each link state packet has a sequence number seq that reflects the order in which the packets were generated. While sending an LSP, a node increments its seq by 1. Each node records the largest seq received from every other node. Packets with higher seq are more recent, and used for updates. Packets with lower seq are considered old, and discarded.

Link State Routing: clarification When a node crashes, all packets stored in it may be lost. After it is repaired, new packets are sent with seq = 0. So these new packets may be discarded in favor of the old packets! Problem resolved using TTL See:

Interval Routing Conventional routing tables have a space complexity O(n). Can we route using a “smaller” routing table? Yes, by using interval routing. This is the motivation. conditionport number Destination > id0 destination < id1 destination = id(local delivery) (Santoro and Khatib)

Interval Routing: Main idea Determine the interva l to which the destination belongs. For a set of N nodes 0.. N-1, the interval [p,q) between p and q ( p, q < N ) is defined as follows: if p < q then [p,q) = p, p+1, p+2,.... q-2, q-1 if p ≥ q then [p,q) = p, p+1, p+2,..., N-1, N, 0, 1,..., q-2, q-1 [3,5) [5,1) [1,3)

Example of Interval Routing N=11 Labeling is the crucial part

Labeling algorithm Label the root as 0. Do a pre-order traversal of the tree. Label successive nodes as 1, 2, 3 For each node, label the port towards a child by the node number of the child. Then label the port towards the parent by L(i) + T(i) + 1 mod N, where - L(i) is the label of the node i, - T(i) = # of nodes in the subtree under node i (excluding i), Question 1. Why does it work? Question 2. Does it work for non-tree topologies too? YES, but the construction is a bit more complex.

Another example Interval routing on a ring. The routes are not optimal. To make it optimal, label the ports of node i with i+1 mod 8 and i+4 mod 8.

Example of optimal routing Optimal interval routing scheme on a ring of six nodes

So, what is the problem? Works for static topologies. Difficult to adapt to changes in topologies. But there is some recent work on compact routing in dynamic topologies (Amos Korman, ICDCN 2009)

Prefix routing Easily adapts to changes in topology, and uses small routing tables, so it is scalable. Attractive for large networks, like P2P networks. a.a.a a.a.b a b When new nodes are added or existing nodes are deleted, changes are only local. λ = empty symbol

Prefix routing λ = empty symbol {Let X = destination, and Y = current node} if X=Y  local delivery [] X ≠ Y  Find a port p labeled with the longest prefix of X Forward the message to p fi

Prefix routing Does it work on non-tree topologies too? Yes. Start with a spanning tree of the graph. ab a.a a.b a.a.a a.b.a ab a.a a.b a.a.a a.b.a λ λ λ λ λ λ λ a.b a.a.a b If (u,v) is a non-tree edge, then the edge label from u to v = label (v) Edge label from u to its parent = λ unless (u, root) is a non-tree edge. In that case, the edge label from u to v = label (v)

Routing in P2P networks: Example of Chord –Small routing tables: log n –Small routing delay: log n hops –Load balancing via Consistent Hashing –Fast join/leave protocol (polylog time)

Consistent Hashing Assigns both nodes and objects from an m-bit key. Order these nodes around an identifier circle (what does a circle mean here?) according to the order of their keys (0.. 2 m -1). This ring is known as the Chord Ring. Object with key k is assigned to the first node whose key is ≥ k (called the successor node of key k)

Consistent Hashing N32 N90 N105 D80 D20 D120 Example: Node 90 is the “successor” of document 80. (0) N=128 Circular 7-bit ID space

Consistent Hashing [Karger 97] Property 1 If there are N nodes and K keys, then with high probability, each node is responsible for (1+  )K/N keys. Property 2 When a node joins or leaves the network, the responsibility of at most O(K/N) keys changes hand (only to or from the node that is joining or leaving. When K is large, the impact is quite small.

Consistent hashing N32 N90 N105 K80 K20 K5 Circular 7-bit ID space Key 5 Node 105 A key k is stored at its successor (node with key ≥ k)

The log N Fingers N80 ½ ¼ 1/8 1/16 1/32 1/64 1/ N120 Finger i points to successor of n+2 i

Chord Finger Table (0) N32 N60 N79 N70 N113 N102 N40 N N N N N N N N102 Node n’s i-th entry: first node  n + 2 i-1 N32’s Finger Table N80 N85 N=128 Finger table actually contains ID and IP address

Routing in Peer-to-peer networks source destination Pastry P2P network

Skip lists and Skip graphs Start with a sorted list of nodes. Each node has a random sequence number of sufficiently large length, called its membership vector There is a route of length O(log N) that can be discovered using a greedy approach.

35 Skip List  L1L1 L2L2 L3L3  31  64  3134    L0L0 Example of routing to (or searching for) node 78. At L2, you can only reach up to 31.. At L1 go up to  As  is bigger than 78, we drop down At L0, reach 78, so the search / routing is over. (Think of train stations)

36 Properties of skip graphs 1.Skip graph is a generalization of skip list. 2.Efficient Searching. 3.Efficient node insertions & deletions. 4.Locality and range queries.

37 Routing in Skip Graphs A 001 J M 011 G 100 W 101 R 110 Level 1 G R W AJM Level 2 A G JMRW Level 0 Membership vectors Link at level i to nodes with matching prefix of length i. Think of a tree of skip lists that share lower layers. Random sequence numbers

38 Properties of skip graphs 1.Efficient routing in O(log N) hops w.h.p. 2.Efficient node insertions & deletions. 3.Independence from system size. 4.Locality and range queries.

Spanning tree construction Chang-Robert’s algorithm {The root is known} {main idea} Uses probes and echoes, and keeps track of deficits C and D as in Dijkstra-Scholten’s termination detection algorithm {initially ∀ i, parent (i) = i} first probe --> parent: = sender; C=1 forward probe to non-parent neighbors; update D echo --> decrement D probe and sender ≠ parent --> send echo C=1 and D=0 --> send echo to parent; C=0 For a graph G=(V,E), a spanning tree is a maximally connected subgraph T=(V,E’), E’  E,such that if one more edge is added, then the subgraph is no more a tree. Used for broadcasting in a network with O(N) complexity. Question: What if the root is not designated? Parent pointer

Graph traversal Many applications of exploring an unknown graph by a visitor (a token or mobile agent or a robot ). The goal of traversal is to visit every node at least once, and return to the starting point. Main issues - How efficiently can this be done? - What is the guarantee that all nodes will be visited? - What is the guarantee that the algorithm will terminate? Think about web-crawlers, exploration of social networks, planning of graph layouts for visualization or drawing etc. DFS (or BFS) traversal is well known, so we will not discuss about it

Graph traversal Review DFS (or BFS) traversals. These are well known, so we will not discuss them. There are a few papers that improve the complexity of these traversals

Graph traversal Rule 1. Send the token towards each neighbor exactly once. Rule 2. If rule 1 is not applicable, then send the token to the parent. Tarry’s algorithm is one of the oldest (1895) A possible route is: The parent relation induces a spanning tree.

Minimum Spanning Tree Given a weighted graph G = (V, E), generate a spanning tree T = (V, E’) E’  E such that the sum of the weights of all the edges is minimum. Applications Minimum cost vehicle routing On Euclidean plane, approximate solutions to the traveling salesman problem, Lease phone lines to connect the different offices with a minimum cost, Visualizing multidimensional data (how entities are related to each other) We are interested in distributed algorithms only The traveling salesman problem asks for the shortest route to visit a collection of cities and return to the starting point.

Example

Sequential algorithms for MST Review (1) Prim’s algorithm and (2) Kruskal’s algorithm. Theorem. If the weight of every edge is distinct, then the MST is unique.