Graph Algorithms. Many problems in networks can be modeled as graph problems.

Similar documents
Graph Algorithms. Many problems in networks can be modeled as graph problems.

Communication network problem. How the routers need to store and forward packets as in Internet/internets/intranets on a hop-by-hop basis.

Routing. Geo-Routing. Thanks to Stefan Schmid for slides

Network Layer: Routing

Chapter 22 Network Layer: Delivery, Forwarding, and Routing 22.1

C13b: Routing Problem and Algorithms

ECE 333: Introduction to Communication Networks Fall 2001

6.02 Fall 2014! Lecture #21. Failures in routing Routing loops Counting to infinity

Lecture 9. Reminder: Homework 3, Programming Project 2 due today. Questions? Thursday, September 22 CS 475 Networks - Lecture 9 1

Why dynamic route? (1)

LECT-05, S-1 FP2P, Javed I.

Redes de Computadores. Shortest Paths in Networks

Computer Networks. Routing

Routing in a network

Routing Algorithms. CS158a Chris Pollett Apr 4, 2007.

Overview. Problem: Find lowest cost path between two nodes Factors static: topology dynamic: load

Lecture 6: Overlay Networks. CS 598: Advanced Internetworking Matthew Caesar February 15, 2011

Module 8. Routing. Version 2 ECE, IIT Kharagpur

ITEC310 Computer Networks II

Link State Routing & Inter-Domain Routing

5.2 Routing Algorithms

Routing Outline. EECS 122, Lecture 15

Top-Down Network Design

Routing. 4. Mar INF-3190: Switching and Routing

Politecnico di Milano Scuola di Ingegneria Industriale e dell Informazione. 06 Routing protocols. Fundamentals of Communication Networks

COM-208: Computer Networks - Homework 6

Distance Vector Routing

Overview 4.2: Routing

Routing. Routing. Overview. Overview. Routing vs. Forwarding. Why Routing

CS 138: Communication I. CS 138 V 1 Copyright 2012 Thomas W. Doeppner. All rights reserved.

Wireless Sensor Networks

Operating Systems and Networks. Network Lecture 7: Network Layer 2. Adrian Perrig Network Security Group ETH Zürich

CSE 461 Routing. Routing. Focus: Distance-vector and link-state Shortest path routing Key properties of schemes

CompSci 356: Computer Network Architectures. Lecture 12: Dynamic routing protocols: Link State Chapter Xiaowei Yang

CompSci 356: Computer Network Architectures. Lecture 13: Dynamic routing protocols: Link State Chapter 3.3.3, Xiaowei Yang

Topics for This Week

Network Routing. Packet Routing, Routing Algorithms, Routers, Router Architecture

Auxiliary protocols. tasks that IP does not handle: Routing table management (RIP, OSPF, etc.). Congestion and error reporting (ICMP).

Distributed Routing. EECS 228 Abhay Parekh

FINAL EXAM - SLOT 2 TCP/IP NETWORKING Duration: 90 min. With Solutions

TDC 363 Introduction to LANs

Outline. Routing. Introduction to Wide Area Routing. Classification of Routing Algorithms. Introduction. Broadcasting and Multicasting

Top-Down Network Design, Ch. 7: Selecting Switching and Routing Protocols. Top-Down Network Design. Selecting Switching and Routing Protocols

Youki Kadobayashi NAIST

Distributed Algorithms 6.046J, Spring, Nancy Lynch

COMP/ELEC 429/556 Introduction to Computer Networks

Network Layer (Routing)

UNIT 2 ROUTING ALGORITHMS

Routing Protocols. Autonomous System (AS)

Network Layer (Routing)

CS 5114 Network Programming Languages Control Plane. Nate Foster Cornell University Spring 2013

CSCD 330 Network Programming Spring 2018

Networking: Network layer

Internetworking - We are heterogeneity to our network (variable network technologies, bandwidth, MTU, latency, etc. etc.)

CSCD 330 Network Programming Spring 2017

Youki Kadobayashi NAIST

Address Translation. Map IP addresses into physical addresses destination host next hop router

Chapter 09 Network Protocols

(Refer Slide Time: 01:08 to 01:25min)

Routing. Information Networks p.1/35

ICMP, ARP, RARP, IGMP

Topology. Youki Kadobayashi NAIST. Outline. Routing system: its function. Gateway Model Revisited. Routing system: its structure

08 Distributed Hash Tables

CS118 Discussion 1A, Week 7. Zengwen Yuan Dodd Hall 78, Friday 10:00 11:50 a.m.

cs/ee 143 Fall

Computer Networking. Intra-Domain Routing. RIP (Routing Information Protocol) & OSPF (Open Shortest Path First)

CS4450. Computer Networks: Architecture and Protocols. Lecture 11 Rou+ng: Deep Dive. Spring 2018 Rachit Agarwal

cs/ee 143 Communication Networks

Distributed Systems Multicast & Group Communication Services

Network Layer, Part 2 Routing. Terminology

Internet Protocol: Routing Algorithms. Srinidhi Varadarajan

CMPE 150: Introduction to Computer Networks

Network Routing - II Failures, Recovery, and Change

Introduction to Communication Networks Spring Unit 15 Internetworking (cont) Routing

Department of Computer and IT Engineering University of Kurdistan. Computer Networks II Border Gateway protocol (BGP) By: Dr. Alireza Abdollahpouri

Link layer: introduction

: Scalable Lookup

Introduction to Intra-Domain Routing

CSCI Spring Final Exam Solution

EITF25 Internet Routing. Jens A Andersson

COMPUTER NETWORK. Homework #3. Due Date: May 22, 2017 in class

Routing in packet-switching networks

5.1 introduction 5.5 The SDN control 5.2 routing protocols plane. Control Message 5.3 intra-as routing in Protocol the Internet

Routing. Outline. Algorithms Scalability

VI. ROUTING. - "routing protocol" nodes exchange information to ensure consistent understanding of paths

Chapter 8 LOCATION SERVICES

Distance vector and RIP

Midterm Review. Topics. Review: Network. Review: Network. Layers & Protocols. Review: Network WAN. Midterm Review EECS 122 EECS 122

Midterm Review EECS 122. University of California Berkeley

Lecture 4. The Network Layer (cont d)

Routing Protocol. Seiya Tsubone. Apr The University of Tokyo. Seiya Tsubone (The University of Tokyo) Routing Protocol Apr. 25.

Youki Kadobayashi NAIST

Copyright 2010, Elsevier Inc. All rights Reserved

CHAPTER 9: PACKET SWITCHING N/W & CONGESTION CONTROL

Routing Overview for Firepower Threat Defense

Basic Idea. Routing. Example. Routing by the Network

Chapter 7 Routing Protocols

From Routing to Traffic Engineering

Routing by the Network

Internet Routing Protocols Tuba Saltürk

Transcription:

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 - max1low algorithm determines the maximum 1low 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 Each belongs to a single administrative domain Autonomous System AS1 Autonomous System AS2 Autonomous System AS3 Intra-AS vs. Inter-AS routing 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 adapta%ons 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 nega<ve weight. Let D(j) = shortest distance of node j from ini8ator 0. D(0) = 0. Ini<ally, i 0, D(i) =. Let w(i, j) = weight of the edge from node i to node j initiator (w(0,j), 0 (w(0,j)+w(j,k)), j k 0 j w(0,m),0 m (w(0,j)+w(j,p)), j p Sender s id 4 0 1 6 5 2 Parent relation The edge weights can represent latency or distance or some other appropriate parameter. 2 1 5 3 3 9 4

Shortest path Revisi8ng Bellman Ford adapta8on : Consider a sta8c topology {Process 0 sends w(0,i),0 to each neighbor i} Current distance {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 4 0 1 6 5 2 2 1 Computes the shortest distance from all nodes to the initiator node 5 3 3 9 4 The parent links help the packets navigate to the initiator

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) 1 3 5 n-4 n-2 2 k 2 k-1 2 2 2 1 2 0 0 4 n-5 2 n-3 n-1 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 1 5 2 4 0 7 1 2 2 7 4 6 2 3 Combines shortest path computation with termination detection. Termination is detected when the initiator receives ack from each neighbor 3 6

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, N-1]. Here, D[i,j] denotes the distance from node i to node j. - Initially i, D[i,i] =0, and 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 j (w[i,j] + D[j,k] ) Used in RIP, IGRP etc

Distance Vector Routing

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 1 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 0 2 3 Observe what can happen when the link (2,3) fails.

Counting to infinity Observe what can happen when the link (2,3) fails. 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 1 D[j,k]=3 means j thinks k is 3 hops away and so on. So it will take forever for the distances to stabilize. A partial remedy is the split horizon method that prevents node 1 from sending the advertisement about d(1,3) to 2 since its first hop (to 3) is node 2 0 2 3 k i: D[i,k] = min j (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.

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: the challenges (Termination of the reliable flooding) How to guarantee that LSPs don t circulate forever? A node forwards a given LSP at most once. (Dealing with node crash) 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: http://www.ciscopress.com/articles/article.asp?p=24090&seqnum=4

Interval Routing (Santoro and Khatib) Conventional routing tables have a space complexity O(n). 1 0 1 0 1 0 1 0 1 0 N N-1 3 2 1 0 Can we route using a smaller routing table? Yes, by using interval routing. This is the motivation. condition Destination > id 0 destination < id 1 destination = id port number (local delivery)

Interval Routing: Main idea Determine the interval 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 [5,1) destinations 5, 6. 7, 0 [1,3) destination 1,2 5 1 3 [3,5) destinations 3,4

Example of Interval Routing 2 3 7 1 0 1 7 3 2 3 4 8 7 5 7 0 5 6 7 N=11 9 9 0 6 8 9 10 0 4 5 6 10 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 0 1 2 3 4 5 6 7 1 7 2 0 1 3 4 3 4 5 6 5 7 6 2 0 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 2 0 5 3 0 1 4 1 2 5 4 2 5 1 3 4 0 3 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 b = empty symbol a.a a a.b b.a b b.b b.c a a.a b a.b b.a b.b b.c a.a.a a.a.b When new nodes are added or existing nodes are deleted, changes are only local.

Prefix routing {A packet arrives at the current node} a b {Let X = destination, and Y = current node} a.a a a.b b b.a b.b b.c if X=Y local delivery [] X Y Find a port p labeled with the longest prefix of X Forward the message to p a.a a.b b.a b.b b.c fi = empty symbol

Prefix routing for non-tree topology Does it work on non-tree topologies too? Yes. Start with a spanning tree of the graph. a a.a a.a a.a.a a a.b a.a.a b a.a.a a.b a.b a.b b a.b.a a.b.a b a.b.a 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 D120" (0)" N105" D20" N=128 Circular 7-bit ID space N32" N90" D80" Example: Node 90 is the successor of document 80.

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 Node 105 Key 5 K5" N105" K20" Circular 7-bit ID space N32" N90" K80" A key k is stored at its successor (node with key k)

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

Chord Finger Table N102" N85" N80" N113" N79" N70" (0)" N=128 N60" N52" N32" N40" N32 s Finger Table 33..33 N40 34..35 N40 36..39 N40 40..47 N40 48..63 N52 64..95 N70 96..31 N102 Finger table actually contains ID and IP address Node n s i-th entry: first node with id n + 2 i-1

Routing in Peer-to-peer networks 130102 destination source 203310 13010-1 1301-10 Pastry P2P network 130-112 1-02113 13-0200

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.

Skip List (Think of train stations) L 3 + L 2 31 + L 1 23 31 34 64 + L 0 12 23 26 31 34 44 56 64 78 + Example of routing to (or searching for) node 78. At L2, you can only reach up to 31.. At L1 go up to 64, As + is bigger than 78, we drop down At L0, reach 78, so the search / routing is over. 35

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. 36

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

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. 38

Spanning tree construction 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. 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 0 1 2 5 {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 root Parent pointer 3 4 Question: What if the root is not designated?

Graph traversal Think about web-crawlers, exploration of social networks, planning of graph layouts for visualization or drawing etc. 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?

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 Tarry s algorithm is one of the oldest (1895) Rule 1. Send the token towards each neighbor exactly once. 3 5 0 1 2 Rule 2. If rule 1 is not applicable, then send the token to the parent. root 4 56 A possible route is: 0 1 2 5 3 1 4 6 2 6 4 1 3 5 2 1 0 The parent relation induces a spanning tree.