TCOM 501: Networking Theory & Fundamentals. Lecture 11 April 16, 2003 Prof. Yannis A. Korilis

Similar documents
Routing. Effect of Routing in Flow Control. Relevant Graph Terms. Effect of Routing Path on Flow Control. Effect of Routing Path on Flow Control

Routing. Information Networks p.1/35

Lecture 19. Broadcast routing

CS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014

CAD Algorithms. Shortest Path

Communication Networks I December 4, 2001 Agenda Graph theory notation Trees Shortest path algorithms Distributed, asynchronous algorithms Page 1

Spanning Trees. CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Motivation. Observations. Spanning tree via DFS

CHAPTER 14 GRAPH ALGORITHMS ORD SFO LAX DFW

CS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

What is Routing? EE 122: Shortest Path Routing. Example. Internet Routing. Ion Stoica TAs: Junda Liu, DK Moon, David Zats

Minimum Spanning Trees and Shortest Paths

Analysis of Algorithms Prof. Karen Daniels

Minimum Spanning Trees and Shortest Paths

Design and Analysis of Algorithms

Lecture 13: Weighted Shortest Paths. These slides include material originally prepared by Dr. Ron Cytron and Dr. Steve Cole.

Lesson 22: Basic Graph Concepts

Shortest Paths and Minimum Spanning Trees

The Shortest Path Problem. The Shortest Path Problem. Mathematical Model. Integer Programming Formulation

Chapter 9: Elementary Graph Algorithms Basic Graph Concepts

CS 6783 (Applied Algorithms) Lecture 5

22 Elementary Graph Algorithms. There are two standard ways to represent a

Note. Out of town Thursday afternoon. Willing to meet before 1pm, me if you want to meet then so I know to be in my office

ÉCOLE POLYTECHNIQUE FÉDÉRALE DE LAUSANNE! 1. Link state flooding topology information finding the shortest paths (Dijkstra)

2.3 Optimal paths. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

ECE 242 Data Structures and Algorithms. Graphs II. Lecture 27. Prof.

Algorithm Design (8) Graph Algorithms 1/2

ECE 158A: Lecture 5. Fall 2015

Dijkstra s algorithm for shortest paths when no edges have negative weight.

Chapter 9 Graph Algorithms

Shortest Paths and Minimum Spanning Trees

Spanning Tree. Lecture19: Graph III. Minimum Spanning Tree (MSP)

2.3 Optimal paths. Optimal (shortest or longest) paths have a wide range of applications:

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

Week 9 Student Responsibilities. Mat Example: Minimal Spanning Tree. 3.3 Spanning Trees. Prim s Minimal Spanning Tree.

CS 43: Computer Networks. 23: Routing Algorithms November 14, 2018

Theorem 2.9: nearest addition algorithm

Lecture 8: The Traveling Salesman Problem

CSC 8301 Design & Analysis of Algorithms: Warshall s, Floyd s, and Prim s algorithms

CSE/EE 461 Lecture 7 Bridging LANs. Last Two Times. This Time -- Switching (a.k.a. Bridging)

Discussion 8: Link State Routing. CSE 123: Computer Networks Marti Motoyama & Chris Kanich

22 Elementary Graph Algorithms. There are two standard ways to represent a

Chapter 9 Graph Algorithms

IP Forwarding Computer Networking. Routes from Node A. Graph Model. Lecture 10: Intra-Domain Routing

3.1 Basic Definitions and Applications

Digraphs ( 12.4) Directed Graphs. Digraph Application. Digraph Properties. A digraph is a graph whose edges are all directed.

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI. Department of Computer Science and Engineering CS6301 PROGRAMMING DATA STRUCTURES II

Lecture 22 Tuesday, April 10

Fundamental Properties of Graphs

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

Shortest path problems

Lecture 19 Thursday, March 29. Examples of isomorphic, and non-isomorphic graphs will be given in class.

Third Generation Routers

COMP 182: Algorithmic Thinking Prim and Dijkstra: Efficiency and Correctness

1 Minimum Spanning Trees (MST) b 2 3 a. 10 e h. j m

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

Module 5 Graph Algorithms

Introduction to Graph Theory

A region is each individual area or separate piece of the plane that is divided up by the network.

Algorithm Analysis Graph algorithm. Chung-Ang University, Jaesung Lee

Graphs and Network Flows IE411. Lecture 21. Dr. Ted Ralphs

Basics of Graph Theory

Chapter 3 Trees. Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path.

Week 11: Minimum Spanning trees

4/25/12. The Problem: Distributed Methods for Finding Paths in Networks Spring 2012 Lecture #20. Forwarding. Shortest Path Routing

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

Reading. Graph Terminology. Graphs. What are graphs? Varieties. Motivation for Graphs. Reading. CSE 373 Data Structures. Graphs are composed of.

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

tree follows. Game Trees

Distance-Vector Routing: Distributed B-F (cont.)

CHAPTER-2 A GRAPH BASED APPROACH TO FIND CANDIDATE KEYS IN A RELATIONAL DATABASE SCHEME **

Chapter 9 Graph Algorithms

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret

09 B: Graph Algorithms II

Basic Graph Theory with Applications to Economics

Single Source Shortest Path

Outline and Reading. Minimum Spanning Tree. Minimum Spanning Tree. Cycle Property. Minimum Spanning Trees ( 12.7)

Trees Rooted Trees Spanning trees and Shortest Paths. 12. Graphs and Trees 2. Aaron Tan November 2017

Review of Graph Theory. Gregory Provan

DFS on Directed Graphs BOS. Outline and Reading ( 6.4) Digraphs. Reachability ( 6.4.1) Directed Acyclic Graphs (DAG s) ( 6.4.4)

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees.

In this lecture, we ll look at applications of duality to three problems:

Section 3.1: Nonseparable Graphs Cut vertex of a connected graph G: A vertex x G such that G x is not connected. Theorem 3.1, p. 57: Every connected

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

Steiner Trees and Forests

Graph Theory. Part of Texas Counties.

7.3 Spanning trees Spanning trees [ ] 61

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

What are graphs? (Take 1)

Graph Theory. Network Science: Graph theory. Graph theory Terminology and notation. Graph theory Graph visualization

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

11.9 Connectivity Connected Components. mcs 2015/5/18 1:43 page 419 #427

Induction Review. Graphs. EECS 310: Discrete Math Lecture 5 Graph Theory, Matching. Common Graphs. a set of edges or collection of two-elt subsets

The Problem: Finding Paths Spring 2011 Lecture #19. Forwarding. Shortest Path Routing

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

Sources for this lecture 2. Shortest paths and minimum spanning trees

Transcription:

TOM 50: Networking Theory & undamentals Lecture pril 6, 2003 Prof. Yannis. Korilis

2 Topics Routing in ata Network Graph Representation of a Network Undirected Graphs Spanning Trees and Minimum Weight Spanning Trees irected Graphs Shortest-Path lgorithms: ellman-ord ikstra loyd-warshall istributed synchronous ellman-ord lgorithm

3 Introduction to Routing What is routing? The creation of (state) information in the network to enable efficient delivery of packets to their intended destination Two main components Information acquisition: Topology, addresses Information usage: omputing good paths to all destinations Questions Where is? How to reach? How to best reach? How to best distribute all traffic (not only to )? G

4 Graph-Theoretic oncepts n Undirected Graph G = (N, ) consists of: a finite nonempty set of nodes N and a collection of arcs, interconnecting pairs of distinct nodes from N. If i and are nodes in N and (i, ) is an arc in, the arc is said to be incident on i and Walk: sequence of nodes (n, n 2,, n k ), where (n, n 2 ), (n 2, n 3 ),, (n k-, n k ) are arcs Path: a walk with no repeated nodes ycle: a walk (n, n 2,, n k ), with n =n k and no other repeated nodes onnected Graph: for all i, N, there exists a path (n, n 2,, n k ), with i=n, =n k G N = {, G,,,,, } = {(, ),(, ),(, ),(, ), (, ),( G, ),( G, )}

5 Spanning Tree graph G' = (N ', ' ), with N ' N and ' is called a subgraph of G Tree: a connected graph that contains no cycles Spanning tree of a graph G: a subgraph of G, that is a tree and contains all nodes of G, that is N ' = N G Lemma: Let G be a connected graph G = (N, ) and S a nonempty strict subset of the set of nodes N. Then, there exists at least one arc (i, ) such that i S, and S.

6 Spanning Tree lgorithm. Select arbitrary node n N, and initialize: G' = (N ', ' ), 2. If N' = N, STOP: G' = (N ', ' ) is a spanning tree LS: go to step 3 3. Let (i, ) with i N' and N-N' Update: N : = N { }, : = {( i, )} Go to step 2 N = {}, n = Proof of correctness: Use induction to establish that after a new node i is added, G' remains connected and does not contain any cycles therefore, it is a tree. fter N- iterations, the algorithm terminates, and G' contains N nodes and N- arcs.

7 onstruction of a Spanning Tree N'= {}; '= N'= {,}; '= {(,)} N'= {,,}; '= {(,),(,)} N'= {,,,}; '= {(,),(,),()} G N'= {,,,,}; '= {(,),(,),(),()} N'= {,,,,,}; '= {(,),(,),(),(),(,)} N'= {,,,,,,G}; '= {(,),(,),(),(),(,),(,G)}

8 Spanning Trees Proposition: Let G be a connected graph with N nodes and links. G contains a spanning tree 2. N- 3. G is a tree if and only if =N- Proof: The spanning tree construction algorithm starts with a single node and at each iteration augments the tree by one node and one arc. Therefore, the tree is constructed after N- iterations and has N- links. vidently N-. If =N-, the spanning tree includes all arcs of G, thus G is a tree. If >N-, there is a link (i, ) that does not belong to the tree. onsidering the path connecting nodes i and along the spanning tree, that path and link (i, ) form a cycle, thus G is not a tree.

9 Use of Spanning Trees Problem: how to distribute information to all nodes in a graph (network) e.g., address and topology information looding: each node forwards information to all its neighbors. Simple, but multiple copies of the same packet traverse each link and are received by each node Spanning tree: nodes forward information only along links that belong to the spanning tree. More efficient: Information reaches each node only once and traverses links at most once Note that spanning tree is bidirectional G

0 Minimum Weight Spanning Tree Weight w i is used to quantify the cost for using link (i, ) xamples: delay, offered load, distance, etc. Weight (cost) of a tree is the sum of the weights of all its links packets traverse all tree links once 5 2 3 6 7 4 2 3 G W = 2 efinition: Minimum Weight Spanning Tree (MST) is a spanning tree with minimum sum of link weights efinition: subtree of an MST is called a fragment. n arc with one node in a fragment and the other node not in this fragment is called an outgoing arc from the fragment. 5 2 3 6 7 4 2 G 3 W = 5

Minimum Weight Spanning Trees Lemma: Given a fragment, let e=(i, ) be an outgoing arc with minimum weight, where. Then extended by arc e and node is a fragment. Proof: Let T be the MST that includes fragment. If e T, we are done. ssume e T: then a cycle is formed by e and the arcs of T Since. there is an arc e e which belongs to the cycle and T, and is outgoing from. Let T =(T-{e }) {e}. This is subgraph with N- arcs and no cycles (since ), i.e., a spanning tree. Since w e w e, the weight of T is less than or equal to the weight of T Then T is an MST, and extended by arc e and node is a fragment. 4 e 4 3 6 7 e' 2 4 3 G

2 Minimum Weight Spanning Tree lgorithms Inductive algorithms based on the previous lemma Prim s lgorithm: Start with an arbitrary node as the initial fragmant nlarge current fragment by successively adding minimum weight outgoing arcs Kruskal s lgorithm: ll vertices are initial fragments Successively combine fragments using minimum weight arcs that do not introduce a cycle

3 Prim s lgorithm 2 3 9 7 5 6 8 4

4 Kruskall s lgorithm 2 3 9 7 5 6 8 4

5 Shortest Path lgorithms Problem: Given nodes and, find the best route for sending traffic from to est: the one with minimum cost where typically the cost of a path is equal to the sum of the costs of the links in the path Important problem in various networking applications Routing of traffic over network links need to distinguish direction of flow ppropriate network model: irected Graph

6 irected Graphs irected Graph or igraph G = (N, ) consists of: a finite nonempty set of nodes N and a collection of directed arcs, i.e., ordered pairs of distinct nodes from N. irected walks, directed paths and directed cycles can be defined to extend the corresponding definitions for undirected graphs Given a digraph G = (N, ), there is an associated undirected graph G' = (N ', ' ), with N '=N and (i, ) ' if (i, ), or (, i) digraph G = (N, ) is called connected if its associated undirected graph G' = (N ', ' ) is connected digraph G = (N, ) is called strongly connected if for every i, N, there exists a directed path (n, n 2,, n k ), with i=n, =n k

7 Shortest Path lgorithms Problem ormulation onsider an N vertex graph G = (N, ) with link lengths d i for edge (i,) (d i = if (i,) ) Problem: ind minimum distance paths from all vertices in N to vertex lternatively, find minimum weight paths from vertex to all vertices in N General approach is again iterative ( n+ ) ( n) = min{ + d i ifferences are in how the iterations proceed Three main algorithms i }

ellman-ord lgorithm Iterative step is over increasing hop count efine ih as a shortest walk from node i to that contains at most h edges h = 0 by definition for all h ellman-ord lgorithm h+ h efine i = min{ + di}, i Set initial conditions to 0 i = for i a The scalars h i are equal to the shortest walk lengths with less than h hops from node i to node b The algorithm terminates after at most N iterations if there are no negative length cycles without node, and it yields the shortest path lengths to node 8

Proof of ellman-ord () Proof is by induction on hop count h or h = we have i = d i for all i, so the result holds for i = ssume that the result holds for all k h. We need to show it still holds for h+ Two cases need to be considered The shortest ( h+) walk from i to has h edges Its length is then i h 2 The shortest ( h+) walk from i to has (h+) edges It consists of the concatenation of an edge (i,) followed by a shortest h hop walk from vertex to vertex This second case is the one we will focus on 9

Proof of ellman-ord (2) rom ase and ase 2, we have shortest ( rom induction hypothesis and initial conditions k i k- i for all k h so that h+ h h = min + d min + d = i h i = d i = d i + h ombining the two gives shortest ( = i min which completes the proof of part a { [ ]} h h, min d h + ) walk length = min + { h h+ } h+, = i h + ) i walk length i = min i [ ] [ ] h i i { [ ]} h h,min + d i i 20 i i

Proof of ellman-ord (3) ssume that the algorithm terminates after h steps This implies that i k = i h for all i and k h This means that adding more edges cannot decrease the length of any of those walks Hence, there cannot be negative length cycles that do not include node They could be repeated many times to make walk lengths arbitrarily small elete all such cycles This yields paths of less than or equal length So for all i we have a path of h hops or less to vertex and with length i h Since those paths have no cycles they contain at most N- edges,and therefore in = N- i for all i The algorithm terminates after at most N steps, which proves part b 2

ellman-ord omplexity Worst-case amount of computation to find shortest path lengths lgorithm iterates up to N times ach iteration is done for N- nodes (all i ) Minimization step requires considering up to N- alternatives omputational complexity is O(N 3 ) More careful accounting yields a computational complexity of O(hM) 22

onstructing Shortest Paths - algorithm yields shortest path lengths, but we are also interested in actual paths Start with - equation i = G [ + d ], i, and 0 min = i or all vertices i pick the edge (i,) that minimizes - equation This generates a subgraph with N- edges (a tree) or any vertex i follow the edges from vertex i along this subgraph until vertex is reached Note: In graphs without zero or negative length cycles, - equation defines a system of N- equations with a unique solution 23

onstructing Shortest Paths = 3 + = 4 + G G = 3 + = 3 = 2 + G = + = 6 + = 6 4 4 7 6 3 2 3 G 4 = --G- 24

ikstra s lgorithm () ifferent iteration criteria lgorithm proceeds by increasing path length instead of increasing hop count Start with closest vertex to destination, use it to find the next closest vertex, and so on Successful iteration requires non-negative edge weights ikstra s algorithm maintains two sets of vertices L: Labeled vertices (shortest path is known) : andidate vertices (shortest path not yet known) One vertex is moved from to L in each iteration 25

ikstra s lgorithm (2) Initialization L = {} and = G - L; (vertex is the destination) = 0 and = d for Iteration steps ind the next closest vertex not in L, i.e., ind the vertex i L such that i = min Update and L: L = L {i} and = - {i} 2 Update lengths of paths of vertices remaining in : = min[ + d lgorithm stops when L = G, i i L ], 26

Proof of ikstra s lgorithm () t the beginning of each step, we have a i for all i L and L b or any vertex, is the shortest distance from to for any path using vertices (except possibly ) only in L Proof of condition (a) (a) is satisfied initially We have d i 0 and i = min L so that condition (a) is preserved by the update equation : = min[, + d ], i non-negative edge weights i 27

Proof of ikstra s lgorithm (2) It remains to prove condition (b), which we proceed to do by induction (b) is satisfied initially Induction hypothesis (H) ondition (b) holds at the beginning of some step, where i is the vertex added to L at that step rom (H), condition (b) holds for vertex i as well as L from (a) onsider next a vertex L {i} 28

Proof of ikstra s lgorithm (3) Let be the length of the shortest path from L {i} to with all its vertices but in L {i} This path consists of an edge (,k), k L {i}, concatenated with the shortest path from k to with vertices in L {i} rom (H), k is the length of this shortest path from k to We have ' = min [ k + d k ] = min min[ k + d k ], i + d k L { i} k L nd from (H) we also have = min[ + d ] ombining the two gives k L Which completes the proof of the induction ' = min[, + d ] = k i k i i 29

omputational omplexity of ikstra s lgorithm s with ellman-ord we have up to N iterations, where N = G The maor saving is that in each iteration we consider each node only once ombination of step and step 2 looks first at nodes in L (step ) and then = G-L (step 2) Operations in each step have unit cost t most N iterations and N unit cost operations per iteration Total cost of O(N 2 ) (can be improved) 30

loyd-warshall lgorithm () Targeted at computing shortest paths between all pairs of vertices an accommodate positive and negative edge weights but requires no negative length cycles Iteration step is on set of vertices allowed as intermediate vertices in a path Initial condition is as for ellman-ord and ikstra, i.e., single edge paths for all vertices Next iteration allows only vertex as intermediate vertex lgorithm stops when all vertices can be used as intermediate vertices 3

loyd-warshall lgorithm (2) Initial conditions 0 i = di, i, and i n Let i be the shortest path length between vertices i and when intermediate vertices on the path are limited to vertices,2,...,n Iteration step is defined as n i + n = min[, + i i( n+ ) ( n+ ) n n ], i heck if distance between vertices i and is improved by using vertex (n+) as an intermediate vertex 32

Proof of loyd-warshall gain by induction or n=0 the initial conditions clearly give the shortest paths without intermediate vertices Induction hypothesis (H) n i or a given n, gives the shortest path length from i to with only vertices to n as intermediate vertices Shortest path from i to with only vertices to (n+) as intermediate vertices either contain vertex (n+) or does not If it does, the length of the path is the 2nd term of the iteration step If it does not, the length of the path is the st term of the iteration step 33

omplexity of loyd-warshall N iterations steps One for each possible set of intermediate vertices omputations in each iteration step involve a comparison for each pair of vertices There are N(N-) of them Total cost is O(N 3 ) quivalent to running N instances of ikstra s algorithm ach instance of ikstra gives shortest paths from all sources to one destination 34

Source ased Shortest Paths Only difference is that we want paths from a source node to all destinations instead of all sources to a destination asic approach remains the same Minor differences in defining initialization conditions and iterative steps We will consider the case of both ellman-ord and ikstra s algorithm 35

Source ased ellman-ord Source is vertex Initialization h = 0, h i0 = for i efine h+ = min{ i h + }, i distance from node to node i in at most h+ hops s before, iterate until no more progress d i 3 4 4 36 G = 5, 4 = 6, 4 = 5 3 = 3, = 3 2 = 3, 2 = 3, 2 = 4, 2 G = 7, 2 = 7 3 = 3, 3 = 3, 3 = 4, 3 G = 5, 3 = 7, 3 = 5 4 = 3, 4 = 3, 4 = 4, 3 G 4

Initialization Source ased ikstra 3 L = {} and = G - L; (vertex is the source) = 0 and i = d for Iteration steps ind next closest vertex in ind the vertex i L such that i = min L Update and L: L = L {i} and = - {i} 2 Update lengths of paths of vertices remaining in : = min[, i + d i ], 3 4 4 G 3 {}; =3, =3 {,}; =3; =3, G =7 {,,}; =3, =3; =4, G =7, =7 {,,,}; =3, =3, =4; G =5, =7, =5 {,,,,}; =3, =3, =4, =5; G =5, =6 {,,,,,G}; =3, =3, =4, =5, G =5; =6 {,,,,,G,}; =3, =3, 37 =4, =5, G =5, =6

Tree of Shortest Paths or the additive distance function we have assumed If the path p=i,i 2,...,i h, with i=i and = i h is a shortest path from i to, then for every k, 0 k h-, the subpath s=i,i 2,...,i k is a shortest path from i to i k If this did not hold, one could improve the shortest path between i and by picking the shorter path that exists between i and i k Let be the distance vector from vertex i, then a directed path p from vertex i to vertex is a shortest path iff k = l + d kl for all edges (k,l) p We can construct a shortest path tree from 38 vertex i to all other vertices

Shortest Path Tree vs Minimum Spanning Tree The two are NOT the same Minimum Spanning Tree Shortest Path Tree 3 3 2 G 3 Total weight: 0 = 6 4 3 3 2 G 3 Total weight: = 5 39 4