CHAPTER 2 Graph Foundations of Network Modelling M. Pickavet and C. Develder 1 Outline 0. Introduction 1. Definition and notations 1.1 Graph 1.2 Digraph 2. Minimum spanning tree problem 3. Shortest path problem 3.1 in unweighted (di)graphs 3.2 in weighted (di)graphs (positive weights) 3.3 in weighted (di)graphs (general weights) 3.4 all-pairs shortest path Graph foundations of network modelling 2 Outline 4. Maximum flow problem 4.1 Network flow 4.2 Problem definition 4.3 Residual network concept 4.4 Flow augmenting path algorithm 4.5 Max-flow min-cut theorem 4.6 Application: calculation of connectivity 5. Minimum cost flow problem 5.1 Introduction 5.2 Problem definition 5.3 Residual network 5.4 Busacker-Gowen algorithm 5.5 Several supply/demand vertices 6. Extension: multi-commodity flow problems Graph foundations of network modelling 3 Outline 0.Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 4 Why graph foundations in a MM network course? efficient transfer of information across a communication network network flow problem flow algorithm Examples : • shortest path problem • maximum flow problem • minimum cost flow problem Graph foundations of network modelling 5 Abstract modelling of communication networks What must be modeled ? all the relevant data of the real network: • topology • transfer of information • different parameters • cost of equipment • capacity of equipment •… Graph foundations of network modelling 6 Outline 0. Introduction 1. Definition and notations 2. 3. 4. 5. 6. 1.1 Graph 1.2 Digraph Minimum spanning tree problem Shortest path problem Maximum flow problem Minimum cost flow problem Extension: multi-commodity flow problems Graph foundations of network modelling 7 Terminology and notations NODE v1 e3 v4 IP router, SDH cross-connect, LINK vATM switch, 2 telephoneSTM-N, switch,... optical fiber, ... e1 e2 e4 e5 v3 • incidence: I (v1) = {e1,e2,e3} • vertex set V • edge set E G =(V, E) • graph order p = #V = 4 • graph size q = #E = 5 • G is a (p, q) - graph • e = uv • adjacency: A(v2) = {v1,v3} • degree: d(v3) = 3 Subgraph G[W] : subset W of vertices of G + edges incident to vertices of subgraph W only example : {v1, v2, v3} ==> {e1, e2, e4} Graph foundations of network modelling 8 Paths and Cycles walk w = (v0, v1, …, vn-1, vn) such that for i = 0, 1, …, n-1, vivi+1 E v1 e3 v4 e1 v2 e2 e4 e5 v3 Special types of walks : paths / cycles (v1, v4, v3) is a path with length 2 (v1, v4, v3, v1) is a cycle with length 3 Walk with all vertices distinct Walk with all vertices but the first and the last distinct Graph foundations of network modelling 10 Cut and Cutset v5 e8 v1 e3 v4 e1 e6 v2 e7 e2 e4 e5 v3 G is connected : " vertex pairs {u, v}, a path exists between u and v • cut, e.g. {e2, e3, e5} • cutset (= minimal cut), e.g. {e3, e5} • vertex-cut, e.g. {v1, v2, v3} • vertex-cutset (= minimal vertex-cut), e.g. {v1, v3} Graph foundations of network modelling 11 Connectivity v5 e8 v1 e3 v4 e1 e6 v2 e6 e7 e2 e4 e5 v5 v3 v1 e3 v4 A graph G with edge-connectivity l(G) = 2 (= minimum cardinality cutset = # {e3,e5}) and vertex-connectivity k(G) = 2 (= minimum cardinality vertex-cutset = # {v1,v3}) e1 v2 e2 e4 e5 v3 A graph G with bridge e6 (note that v5 is not a cutvertex) l(G) = 1, k(G) = 1 Graph foundations of network modelling 12 Connectivity EXERCISE v6 v5 v8 v7 v1 v3 v4 edge-connectivity l(G) = ? vertex-connectivity k(G) = ? v2 Graph foundations of network modelling 13 Outline 0. Introduction 1. Definition and notations 2. 3. 4. 5. 6. 1.1 Graph 1.2 Digraph Minimum spanning tree problem Shortest path problem Maximum flow problem Minimum cost flow problem Extension: multi-commodity flow problems Graph foundations of network modelling 14 Digraph Directed Graph v1 a3 v4 a1 • vertex set V • arc set A v2 D = (V,A) a2 a4 a5 • digraph order = #V = 4 • digraph size = #A = 5 v3 • from - incidence : I (v1) = {a1, a3} • to - incidence : I’(v4) = {a3, a5} • from - adjacency : A(v3) = {v1,v4} • to - adjacency : A’(v2) = {v1} • out - degree : d(v3) = 2 • in - degree : d’(v1) = 1 Graph foundations of network modelling 15 Paths and Cycles walk w = (v0, v1, …, vn-1, vn) such that for i = 0, 1, …, n-1, (vi,vi+1) A semiwalk = (v0, v1, …, vn-1, vn) such that for i = 0, 1, …, n-1, (vi,vi+1) A (vi+1,vi A v1 a3 v4 a1 v2 a2 a4 a5 v3 (v1, v2, v3) is a path with length 2 (v1, v2, v3, v1) is a cycle with length 3 (v1, v4, v3) is a semipath with length 2 (v1, v4, v3, v1) is a semicycle with length 3 Graph foundations of network modelling 17 Strong and weak connectedness v5 v5 v1 v2 v1 v2 v4 v3 v4 v3 this digraph is strongly connected (u,v)- AND (v,u)-paths this digraph is weakly connected (u,v)- AND/OR (v,u)-path there are no paths terminating in v3 Graph foundations of network modelling 18 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 19 Tree and spanning tree v5 v5 v1 v4 v2 v3 a tree T=(V,F) • T is connected • T does not contain cycles T contains #V-1 edges v1 v2 v4 v3 a spanning tree T=(V,F) of G • T is a tree • T has the same vertex set as G Graph foundations of network modelling 20 MST: algorithm of Kruskal weighted graph c(e) = weight of edge e weight of weighted graph = sum of weights of all edges minimum spanning tree = spanning tree with minimum weight (in a weighted graph) Mackinaw City Traverse City 3 105 4 170 306 85 245 135 5 180 6 Benton Harbor {insertion of edge 56 with weight 85 into F} P = { {1}, {2}, {3}, {4}, {5,6} } 206 210 140 Grand Rapids P = { {1}, {2}, {3}, {4}, {5}, {6} } 2 270 137 139 Sagninaw {insertion of edge 34 with weight 105 into F} P = { {1}, {2}, {3,4}, {5,6} } {insertion of edge 12 with weight 112 into F} P = { {1,2}, {3,4}, {5,6} } 112 300 1 Detroit {insertion of edge 25 with weight 135 into F} P = { {1,2,5,6}, {3,4} } {insertion of edge 45 with weight 140 into F} Graph foundations of P = { {1,2,3,4,5,6} } network modelling 21 Minimum spanning tree: applications Characteristics MST: • network infrastructure connecting all ‘entities’ • minimal cost price is key • no fault-tolerance not important ? • unique path unequivocal routing, cycles avoided Applications area: • communication networks: • minimal topology • virtual tree network • other networking situations: • electricity network • sewer system network •… Graph foundations of network modelling 22 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 3.1 3.2 3.3 3.4 In unweighted (di)graphs In weighted (di)graphs (positive weights) In weighted (di)graphs (general weights) All-pairs shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 24 Distance in unweighted graph The length of a path in an unweighted graph is equal to the number of edges in the path (=‘hopcount’). The distance d(u,v) between two vertices u,v in a graph G = (V,E) is equal to the length of a shortest u,v-path in G, if such a path exists (if not: d(u,v) = ). Graph foundations of network modelling 25 Example : the Moore Algorithm s v1 G: s v2 v4 v3 v1 Labels 0 v5 v2 1 v3 2 v6 v4 v5 v7 v8 v9 v6 v10 3 v7 v10 v8 v9 s 0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 0 1 1 1 0 1 1 2 2 1 2 2 0 1 1 2 2 1 2 3 2 Graph foundations of network modelling 26 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 3.1 3.2 3.3 3.4 In unweighted (di)graphs In weighted (di)graphs (positive weights) In weighted (di)graphs (general weights) All-pairs shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 27 Distance in weighted graph Weighted Graph : c : E R : map every edge to a real number Length of a path : sum of length of its edges Distance between two vertices s,t : length of shortest s,t path Graph foundations of network modelling 28 Algorithm of Dijkstra Assumption : all weights positive !! µ0=s 8 13 v6 v2 9 11 7 v7 v4 17 14 shortest path tree v5 16 temporal branches new branches 5 v3 l(µ0) v2 v3 v4 v5 v6 v7 add to P 0 (,-) (,-) (,-) (,-) (,-) (,-) µ0 (13,µ0) (,-) (16,µ0) (8,µ0) (,-) (,-) v5 (13,µ0) (25,v5) (15,v5) (,-) (,-) v2 (25,v5) (15,v5) (,-) (,-) v4 (,-) (,-) v3 (,-) (,-) (20,v4) Graph foundations of network modelling 29 Dijkstra EXERCISE v1 2 1 1 u0 3 v4 v6 v2 4 2 5 6 3 v5 4 5 1 2 d(u0,v5) ? 1. op zicht 2. m.b.v. Dijkstra v3 2 v7 3 v8 Graph foundations of network modelling 31 Dijkstra EXERCISE Graph foundations of network modelling 32 Algorithm of Dijkstra: application Router C : Link-State Database [AB,AE] incoming link state packets [AB,BD,BC] [BD,CD,DE] [AE,DE] Link AB AE BD BC CD DE Cost 1 1 1 1 1 1 knowledge of network topology From A A B B D D Dijkstra : shortest paths A E B LSA E {E-D, E-A} LSA E {E-D, E-A} LSA E {E-D, E-A}LSA E {E-D, E-A} C Router C : Routing Table Dest. D LSA E {E-D, E-A} A B D E Next hop B Direct Direct D Interface BC BC CD CD Graph foundations of network modelling 33 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 3.1 3.2 3.3 3.4 In unweighted (di)graphs In weighted (di)graphs (positive weights) In weighted (di)graphs (general weights) All-pairs shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 34 The algorithm of Ford, Bellman and Moore Result with Dijkstra: l(v1) = 3 4 l(v2) = 4 v2 1 3 s l(s) = 0 - 4 v1 1 2 1 v4 l(v4) = 1 1 l(v1) l(v2) + c(v2v1) is violated l(v1) is updated and set to l(v1) = l(v2) + c(v2v1) =0 v3 t l(t) = 5 4 l(v3) = 2 Principle : label correcting algorithm Let l(i), iV be a set of labels. These labels represent the shortest path distances from the source vertex s if they satisfy the following conditions: (i) l(s) = 0; (ii) l(i) is the length of some (s,i)-path; (iii) l(j) l(i) + c(ij), "(i,j) A Graph foundations of network modelling 35 The algorithm of Ford, Bellman and Moore (1) l(s) := 0 ; "vV\{s} do l(v) := end; (2) insert s into List; (3) while List is not empty do l(s)=0, l(v1)=l(v2)=…=l(t)= List={s} (4) select the first element v from List and remove it from List; (5) "wA(v) do (6) A(v)={v1,v4} A(v)={v4} if l(w) > l(v) + c(vw) l(v1)=4, l(v4)=1 l(v4)=1 (7) l(w) := l(v) + c(vw); (8) List; if w is not yet an element of List, insert w at the back of (9) end; (10) end; A(v)=from-adjacency in digraph v=s, List } } v=v1, List=={ {v4 4 l(s)=0 - 4 v1 v2 1 3 s List = {v1,v4 } List = {v4 } 2 1 Extension : negative cycles ? 1 t 4 v4 v3 1 Graph foundations of network modelling 36 Ford-Bellman-Moore EXERCISE v1 2 -1 v4 3 2 v3 -6 5 1 u0 v2 4 6 v5 4 3 5 1 v6 2 v7 3 v8 Graph foundations of network modelling 38 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 3.1 3.2 3.3 3.4 In unweighted (di)graphs In weighted (di)graphs (positive weights) In weighted (di)graphs (general weights) All-pairs shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 39 All-pairs shortest path problem Until now: • Shortest path from s to t • Side effect: shortest path tree from s to all other nodes Current subsection: Shortest path between ALL PAIRS OF NODES v1 Possible approaches: 8 • p times Dijkstra 13 v5 16 • Dedicated algorithm: Floyd v2 7 11 v4 17 14 5 v3 Graph foundations of network modelling 40 Algorithm of Floyd Step 0: direct paths distances Assumption : all weights positive !! Step 1: x – v1 – y better ? v1 v2 v3 v4 v5 v1 0 13 16 8 11 v2 13 0 14 29 11 5 17 v3 14 0 5 17 5 0 7 v4 16 29 5 0 7 17 7 0 v5 8 11 17 7 0 v1 v2 v3 v4 v5 v1 0 13 16 8 v2 13 0 14 ? v3 14 0 v4 16 v5 8 11 v1 Step 2: x – v2 – y better ? v1 v2 v3 v4 v1 0 13 27 16 8 v2 13 0 14 29 11 v3 27 14 0 5 17 v4 16 29 5 0 7 v5 8 11 17 7 0 8 v5 13 v2 v5 16 7 11 v4 17 14 5 v3 Graph foundations of network modelling 41 Algorithm of Floyd Step 3: x – v3 – y better ? v1 v2 v3 v4 v1 0 13 27 16 8 v2 13 0 14 19 v3 27 14 0 v4 16 19 v5 8 11 Step 4: x – v4 – y better ? v5 v1 v2 v3 v4 v5 v1 0 13 21 16 8 11 v2 13 0 14 19 11 5 17 v3 21 14 0 5 12 5 0 7 v4 16 19 5 0 7 17 7 0 v5 8 11 12 7 0 v1 Step 5: x – v5 – y better ? v1 v2 v3 v4 v1 0 13 20 15 8 v2 13 0 14 18 11 v3 20 14 0 5 12 v4 15 18 5 0 7 v5 8 11 12 7 0 8 v5 13 v2 v5 16 7 11 v4 17 14 5 v3 Graph foundations of network modelling 42 Algorithm of Floyd (1) D(0) = A; (2) for step := 1 to p do (3) (4) for vi := v1 to vp do for vj := v1 to vp do (5) (6) (7) di,j(step) := min {di,j(step-1) , di,vstep(step-1) + dvstep,j(step-1) } end; end; (8) end. v1 8 Implementation effort: small 13 v5 16 Time complexity: O(p3) p times Dijkstra: p x O(p2) v2 7 11 v4 17 14 5 v3Graph foundations of network modelling 43 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 4.1 4.2 4.3 4.4 4.5 4.6 Network flow Problem definition Residual network concept Flow augmenting path algorithm Max-flow min-cut theorem Application: calculation of connectivity 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 44 Network flow models abstract modelling of a communication network transfer of information flow topology directed graph (digraph) D = (V,A) every arc a A has associated numerical values cost c(a) weighted digraph capacity u(a) capacitated digraph network N = weighted, capacitated digraph (V,A) Graph foundations of network modelling 45 Network flow-associated constraints flow function f (.) : A Z+ or R+ subject to the following constraints: flow conservation I’(v) v capacity constraints I(v) • supply vertex : b(v) > 0 (source) • demand vertex : b(v) < 0 (sink) u(a) = capacity of link Graph foundations of network modelling 46 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 4.1 4.2 4.3 4.4 4.5 4.6 Network flow Problem definition Residual network concept Flow augmenting path algorithm Max-flow min-cut theorem Application: calculation of connectivity 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 47 Problem definition : maximum flow 2 v1 5 1 Source s 3 v4 v2 1 3 4 1 v3 t Sink 3 i capacity j u(ij) Graph foundations of network modelling 48 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 4.1 4.2 4.3 4.4 4.5 4.6 Network flow Problem definition Residual network concept Flow augmenting path algorithm Max-flow min-cut theorem Application: calculation of connectivity 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 49 Residual network concept flow i residual capacity capacity [ f °(ij),u(ij)] j r(ij) i 3 3 0,4] [3,4 Source 0,5] [5,5 3,5 [2,3 0,3] 1 [2,2 0,2] flow=3 flow=2 j 4 [0,1] 2 original network 1 Sink 5 3 2 1 1 4 1 2 2 residual network Graph foundations of network modelling 50 Residual Network EXERCISE i [ f °(ij),u(ij)] j [4,4] [1,2] [3,5] [0,1] [1,1] [1,3] [1,2] Graph foundations of network modelling 51 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 4.1 4.2 4.3 4.4 4.5 4.6 Network flow Problem definition Residual network concept Flow augmenting path algorithm Max-flow min-cut theorem Application: calculation of connectivity 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 52 Flow Augmenting Path Algorithm determine the maximum flow between two vertices s and t in a network N. 3 residual network N(f) : 2 source 2 11 2 1 1 augmenting path ? 4 4 sink d = residual capacity of augmenting path 1 2 2 (1) (2) (3) (4) (5) (6) (7) f := 0; while ( N (f ) contains at least one augmenting path from s to t ) do identify one augmenting path P from vertex s to vertex t; d := min{r(ij) : ij P}; augment the flow f with d units along P; update N (f ); od Graph foundations of network modelling 53 Flow Augmenting Path Algorithm r(ij) i j 3 3 5 4 4 1 4 1 4 3 Source 2 Sink 1 2 1 2 (a) (b) 3 3 4 5 2 1 1 2 4 4 3 4 1 1 5 2 1 1 1 2 (c) 4 1 1 2 2 (d) Graph foundations of network modelling 54 Do we need a residual network ?? [ f ij u ij ] ( ), ( ) i Orig. ? 2 [0,2] j [0,2] 4 [2,2] [2,2] Source 1 [2,2] 3 Res. [0,2] i 5 2 [f (ij), u(ij)] 2 2 2 (c) 2 [2,2] 2 5 i Orig. 4 2 3 3 r(ij) 2 2 2 (b) j 6 3 2 j [2,2] 4 [0,2] 1 [2,2] 6 2 (a) 2 1 4 2 1 [0,2] j 2 2 2 6 Sink 5 r(ij) i Res. [2,2] 6 [2,2] 5 [2,2] (d) Graph foundations of network modelling 57 Maximum Flow Algorithm EXERCISE A 2 7 5 1 2 5 1 5 2 2 i 5 j 2 2 2 i cap 5 1 3 B capacity j u(ij) Graph foundations of network modelling 58 Maximum Flow Algorithm: applications Characteristics max. flow solution: • from one source to one destination • maximal use of network BW bifurcation of flow compliant with application ? (different delays, reordering, …) • cost of paths not taken into account Some applications: • maximum BW from server client • indication on available BW source destination • restoration mechanism: available spare capacity ? Graph foundations of network modelling 59 Maximum Flow Algorithm: applications via spare capacity in network Graph foundations of network modelling 60 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 4.1 4.2 4.3 4.4 4.5 4.6 Network flow Problem definition Residual network concept Flow augmenting path algorithm Max-flow min-cut theorem Application: calculation of connectivity 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 61 The Maximum-Flow Minimum-Cut Theorem correspondence between flows and cuts in a network minimum cut problem : “From among all cuts in the network that separate the source and the sink, find the cut with minimum capacity”. Network example: u(ij) i 4 2 v1 1 Source s 2 j v2 1 4 1 t Sink 3 v4 3 st : 6 v3 st : 8 Graph foundations of network modelling 62 The Maximum-Flow Minimum-Cut Theorem Theorem: The maximum value of a flow between s and t = capacity of a minimum s,t-cut Example: maximum s,t-flow F = 6 f(ij) i v1 4 Source 2 1 s 2 v4 j v2 1 3 minimum-cut 3 1 v3 t Sink 3 Graph foundations of network modelling 64 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 4.1 4.2 4.3 4.4 4.5 4.6 Network flow Problem definition Residual network concept Flow augmenting path algorithm Max-flow min-cut theorem Application: calculation of connectivity 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 65 Calculation of edge-connectivity l(v,w) = minimum cardinality of a v,w-edge-cutset l(G) = edge-connectivity of graph G = min{l(v,w) | v,w V }. How to calculate l(v,w) ? Graph G Max flow min cut theorem : l(v,w) = maximum flow F(v,w) (if all link capacities = 1) x Residual Network : v w 1 1 1 1 v 1 1 y l(v,w) = 3 l(x,y) = 2 ... 1 1 l(G) = 2 1 1 1 1 1 1 1 w 1 l(v,w) = max. # edge-disjoint paths between v and w Graph foundations of network modelling 66 Calculation of edge-connectivity 1 1 1 1 1 v 1 1 1 1 1 1 1 1 2 1 1 w 2 2 1 v 1 1 1 1 1 1 1 2 v 2 2 2 2 2 2 w 1 2 v 1 2 2 2 2 2 1 1 2 w 1 3 edge-disjoint paths l(v,w)=3 w 2 Graph foundations of network modelling 67 Calculation of vertex-connectivity k(v,w) = minimum cardinality of a v,w-vertex-cutset k(G)=min{k(v,w) | v,w V, vw E} How to calculate k(v,w) Graph G k(v,w) = max. # vertex-disjoint paths between v and w x • Split vertices : v’, v” • Interconnect vertices : v’v”, v’w”, v”w’ (all link capacities = 1) x’ v (v,w non adjacent) w x” l 1 1 1 y k(v,w) = 2 k(G) = 2 1 l v’ 1 v”= s 1 1 1 y’ • k(v,w) = maximum flow F(v”,w’) l t = w’ l w” 1 y” Graph foundations of network modelling 68 Calculation of vertex-connectivity x’ x” l 1 1 1 1 l v’ 1 v” 1 1 1 y’ w’ l l w” 1 y” k(v,w) = 2 Graph foundations of network modelling 69 Connectivity: applications Network survivability: • • • • to cope with single link failures: edge-connectivity 2 to cope with single node failures: vertex-connectivity 2 to cope with two links failing simultaneously: edge-connectivity 3 … Graph foundations of network modelling 70 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 5.1 5.2 5.3 5.4 5.5 Introduction Problem definition Residual network Busacker-Gowen algorithm Several supply/demand vertices 6. Extension: multi-commodity flow problems Graph foundations of network modelling 71 Introduction Example: i [3,5] Server Source [c (ij),u (ij)] [5,2] v1 [1,1] s [2,3] [1,1] j v2 [1,4] [1,1] t Sink Client [3,3] v4 [2,3] v3 demand (sourcesink) = 6 Minimize the total cost of flow with respect to how to route the flow subject to • the flow value on each arc respects the arc capacity • the total flow fulfills the demand between s and t Graph foundations of network modelling 72 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 5.1 5.2 5.3 5.4 5.5 Introduction Problem definition Residual network Busacker-Gowen algorithm Several supply/demand vertices 6. Extension: multi-commodity flow problems Graph foundations of network modelling 73 Problem definition Optimisation model for minimum cost flow problem Graph foundations of network modelling 74 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 5.1 5.2 5.3 5.4 5.5 Introduction Problem definition Residual network Busacker-Gowen algorithm Several supply/demand vertices 6. Extension: multi-commodity flow problems Graph foundations of network modelling 75 Residual network concept original network N with a certain flow f °(ij) corresponding residual network N( f °) every arc (i,j) in original network two arcs (i,j) and (j,i) in residual network [c(ij), r(ij) = u(ij) - f °(ij)] i c(ij),u(ij),f(ij) j i j [-c(ij), r(ji) = f °(ij)] Graph foundations of network modelling 76 Residual network : example original network N with a certain flow f ° i [c(ij),u(ij)] f °(ij) corresponding residual network N( f °) j [c(ij),r(ij)] i 3 3 [4,4] Source 1 [2,2] 2 [1,3] 2 2 (a) [1,2] [4,4] [1,4] [-1,2] 4 [3,2] 2 j Sink 1 [-1,2] [1,1] 4 [3,2] [-2,2] 2 (b) Graph foundations of network modelling 77 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 5.1 5.2 5.3 5.4 5.5 Introduction Problem definition Residual network Busacker-Gowen algorithm Several supply/demand vertices 6. Extension: multi-commodity flow problems Graph foundations of network modelling 78 The algorithm of Busacker and Gowen algorithm to determine a minimum cost flow f in a network N from a source vertex s to a sink vertex t with value d (demand). (1) (2) (3) (4) (5) (6) (7) (8) f := 0; // initially there is no flow in the network while ( F < d ) do identify the shortest augmenting path P from s to t in N( f ); d:= min { min{ r(ij) : ij P }, (d - F ) } ; augment the flow f along P with d; update N ( f ); F :=F + d; od Remarks : (i) It is assumed that a feasible flow from s to t with value d is possible. (ii) Flow value = F = Graph foundations of network modelling 79 Busacker-Gowen : example i [c(ij),u(ij)] (a) [4,2] s [3,4] [1,2] (b) v1 [4,2] s v4 v1 [3,4] [-1,2] v4 demand ( s t ) j [1,2] v2 [1,4] [1,2] [-1,2] [1,2] [3,4] v3 v2 [-1,2] [1,2] [-1,2] f=2 (c) cost path = 5 s t f=2 cost path = 7 [-1,2] t [4,3] [-1,2] v1 [-4,2] [1,4] [3,4] v2 v4 (d) [4,2] s [-1,2] v1 [3,4] [1,2] v4 [-1,2] [3,4] [-1,2] [4,3] [3,4] v3 d=4 [1,2] [1,4] [-4,2]t [4,1] v3 v2 [1,2] [3,4] v3 t [4,3] [1,2] Graph foundations of network modelling 80 Busacker-Gowen EXERCISE [2,2] s [3,2] v1 [3,4] v4 [3,1] v2 d =3 [1,2] [1,4] t [3,4] [3,2] v3 [2,2] i [c(ij),u(ij)] j Graph foundations of network modelling 81 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 5.1 5.2 5.3 5.4 5.5 Introduction Problem definition Residual network Busacker-Gowen algorithm Several supply/demand vertices 6. Extension: multi-commodity flow problems Graph foundations of network modelling 82 Several supply/demand vertices Example : Optimisation model : minimize c( a ) f ( a ) s1 [c(ij),u(ij)] i [5,2] t1 b(s1) = +5 a A subject to f (a ) - a I ( v ) [1,1] f (a ) = b(v) , " v V a I '( v ) s2 0 f ( a ) u( a ) , " a A Min cost flow algorithm : [0,5] super-supply s s1 [1,1] [0,2] [1,1] s2 [5,2] [1,1] [2,3] [1,1] t2 [2,3] t1 b(s2) = +2 b(t1) = -4 b(t2) = -3 [0,4] t [1,1] t2 j super-demand [0,3] demand = 5+2 = 4+3 = 7 Graph foundations of network modelling 83 Outline 0. Introduction 1. Definition and notations 2. Minimum spanning tree problem 3. Shortest path problem 4. Maximum flow problem 5. Minimum cost flow problem 6. Extension: multi-commodity flow problems Graph foundations of network modelling 84 The concept ‘commodity’ A commodity = one uniform product Sections 3, 4 and 5 : single-commodity flow problems e.g. oil / electricity distribution system This section : multi-commodity flow problems e.g. telephone network Several multi-commodity problems : natural extensions of the single-commodity problems e.g. multi-commodity minimum cost flow problem Graph foundations of network modelling 85 Multi-commodity min cost flow problem Optimisation model for the multi-commodity min cost flow problem : c( a ) f k ( a ) minimize a A subject to k K weighted capacitated digraph f k (a ) - f k (a ) = bk (v) a I ( v ) 0 , "v V , "k K a I '( v ) f k ( a ) u( a ) , "a A f1 k K Distinction between two problems : 1 • fk(a) integer : integer MCMCF problem • fk(a) real : linear MCMCF problem Capacity of arc = 1 f1=f2=f3=1 integer MCMCF : cost = 202 linear MCMCF : cost = 153 f2 0.5 1 1 0.5 1 cost=100 2 f1 f3 3 f2 cost=1 f3 Graph foundations of network modelling 86 Application: IP routing vs. MPLS Traffic Eng. Problem: demands for traffic between every pair of IP(/MPLS) routers IP: only shortest paths allowed algorithm of Dijkstra A B E D C IP/MPLS: explicit routes possible (‘traffic engineering’) mathematical formulation: multi-commodity flow problem very refined granularity (one IP packet = some bytes typical arc capacity = 100s Mbit/s) flow variable has an almost continuous nature real fk(a) variables allowed Graph foundations of network modelling 87 Limitations of graph algorithms Example of multi-commodity flow problems: • distinction between real and integer problem arises • no efficient graph algorithms as solution method More in general: • graph algorithms for ‘easy’ problems • or parts of ‘difficult’ problems (e.g. network design) next chapter: • general optimisation techniques • real vs. integer Graph foundations of network modelling 88 References [1] N. Christofedes: Graph Theory: an Algorithmic Approach (Academic Press, New York, 1975). [2] G. Chartrand, O. Oellermann: Applied and Algorithmic Graph Theory (McGraw-Hill, New York, 1993). [3] R.K.Ahuja, T.L.Magnanti, J.B.Orlin, Network Flows (PrenticeHall, New Jersey, 1993). [4] M.O.Ball, T.L.Magnanti, C.L.Monma, G.L.Nemhauser, Handbooks in Operations Research and Management Science, vol. 7, Network Models (North-Holland, Amsterdam, 1995). Graph foundations of network modelling 89