Graph Theory A loop is an edge where

  • Slides: 57
Download presentation
Graph Theory • • A loop is an edge where both endpoints are the

Graph Theory • • A loop is an edge where both endpoints are the same Two edges are parallel if they have the same end points. A graph is simple if there is no loops or parallel edges. The degree of a node is the number of edges in the graph that have the node as an endpoint. The degrees of nodes in a graph are important graph property. A component of a graph is a maximal connected subgraph. A Tree is a connected, simple graph without cycles. Any tree with n nodes has n-1 edges. Trees are optimal network designs when links have very high capacity or enormously expensive, and there is no reliability constraints. C. Edward Chow

Minimum Cost Network Problem: Given the distances among 4 cities, build the minimum road

Minimum Cost Network Problem: Given the distances among 4 cities, build the minimum road to connect them. Assume $1000/km to build the road. Solution: Choose the shorter distance links first and avoid those links that connect nodes already included. This is Kruskal’s MST Algorithm. C. Edward Chow

Minimum Cost Network • • Select Charmes-Duval, Bregen-Charmes, Avoid Bregen-Duval since both them already

Minimum Cost Network • • Select Charmes-Duval, Bregen-Charmes, Avoid Bregen-Duval since both them already included. Choose Anagon-Charmes. The results is a star topology. End 1 End 2 Cost Charmes Duval 562, 000 Bregen Charmes 972, 000 Anagon Charmes 1, 168, 000 C. Edward Chow

Topology • A tree is a star if only one node has degree greater

Topology • A tree is a star if only one node has degree greater than 1. • A tree is a chain if no node has degree greater than 2. • A graph G is weighted if there is a real number associated with each edge. It is denoted as (G, w). • The weight of an edge e is denoted as w(e). • The weighting function w: E R+. • If G is connected, we like to select a connected subgraph with minimum weight. C. Edward Chow

Kruskal’s MST Algorithm • • • MST Minimum Spanning Tree. Check if graph is

Kruskal’s MST Algorithm • • • MST Minimum Spanning Tree. Check if graph is connected. If not, abort. Sort the edges in ascending order by weight. Mark each node as separate component. Loop on the edges until we accepted |V|-1 edges. Let e be the candidate edge. – If the endpoints are in different components, merge the two components and accept the edge and increment the # of edges accepted by 1. C. Edward Chow

Prim’s MST Algorithm • Start with a node v, no edge, T 0=(v, ).

Prim’s MST Algorithm • Start with a node v, no edge, T 0=(v, ). • Add least expensive edge. 1: Tree *Prim(Graph *G, Node *root) { 2: 3: for_each(node, G nodes) { 4: node label = INF; 5: node intree = FALSE; 6: } 7: root label = 0; 8: root pred = root; 9: Nodes. Chosen = 0; 10: C. Edward Chow

11: while (Nodeschosen < Number. Nodes(G)) { 12: node=Find. Min. Label(G); /* Only nodes

11: while (Nodeschosen < Number. Nodes(G)) { 12: node=Find. Min. Label(G); /* Only nodes not in the tree are checked. */ 13: node intree = TRUE; 14: ++Node. Chosen; 15: for_each(node 2, node adjacent_nodes) { 16: if (node 2 intree == FALSE && 17: node 2 label > weight(edge(node, node 2)) { 18: node 2 ->pred=node; 19: node 2 label=weight(edge(node, node 2)); 20: } /* endif */ 21: } /* endfor */ 22: } /* endwhile */ 23: 24: tree=create_Tree(); 25: Build. Tree. From. Preds(G, tree); 26: return(tree); 27: } /* end Prim */ C. Edward Chow

Use Delite to Calculate MSTs • • • Start Delite. Select Start | Programs

Use Delite to Calculate MSTs • • • Start Delite. Select Start | Programs | Delite. Select File | Read Input File | Prim. INP. The nodes are displayed. Select Design | Prim for displaying the result of the Prim MST Algorithm. The legend window shows the link_cost of the MST. Select Display | Select Map File | USAVH. met for overlay Map file. The result display is shown next. Select Design | Set Input Parameters | Trace | Yes to generate. trc trace file. Use Notepad/wordpad to view the Prim. trc or Prim. INP file. C. Edward Chow

9/3/2021 C. Edward Chow 9

9/3/2021 C. Edward Chow 9

Tree Designs • MST is good when – Links are highly reliable – Networks

Tree Designs • MST is good when – Links are highly reliable – Networks can tolerate low reliability – The number of sites are small. • Either Prim’s or Kruskal’s algorithm gives optimal solution. • MST’s are not good networks to use when the number of nodes is large. C. Edward Chow

Squreworld Counter-example • 1000 miles x 1000 miles. • One type of transmission lines

Squreworld Counter-example • 1000 miles x 1000 miles. • One type of transmission lines 1 Mbps. • Cost for two sites with locations (x 1, y 1) and (x 2, y 2) with distance d = ($1000+$10*d)/month. • Consider problems with 5, 10, 20, 50, and 100 sites, traffic are normalized with 1 kbps from one site to another. The traffic volumes grows quadratically: N 2 x Total Traffic 5 20 20 kbps 10 90 90 kbps 20 380 kbps 50 2450 kbps 100 9900 9, 900 kbps C. Edward Chow

MST for 5 Node Network C. Edward Chow

MST for 5 Node Network C. Edward Chow

Generate Files for Squreworld Counter-example • Compile the c: Program FilesDeliteSourcegen. c • Run

Generate Files for Squreworld Counter-example • Compile the c: Program FilesDeliteSourcegen. c • Run gen <number of nodes> <filename. gen> to produce the 5, 20, 50, 100 nodes files. • Run delite, select File | Generate Input • Select the corresponding. gen file. • The monitor will show the files are successfully generated. They include. REQ (traffic requirement), . CST (cost file. ). • Edit the. REQ file, replace the link bandwidth with 1000. C. Edward Chow

MST for 10 Node Network C. Edward Chow

MST for 10 Node Network C. Edward Chow

Legginess? in Network • Traffic in the above 10 node MST takes a circuitous

Legginess? in Network • Traffic in the above 10 node MST takes a circuitous route between source and destination. • To quantify the legginess in the network, we define: Definition 3. 17: The number of hops (hop count) between node n 1 and n 2 is the number of edges in the path chosen by the routing algorithm for the traffic flowing from n 1 to n 2. If only one path is chosen or if all paths chosen have the same number of edges, then we denote the number by hops(n 1, n 2). C. Edward Chow

Average # of Hops • Although the two routes between a pair of nodes

Average # of Hops • Although the two routes between a pair of nodes can be asymmetric, there is only one path between a pair of nodes in a tree. Definition 3. 18: The average number of hops in a network, • The average number of hops is quite important in evaluating MST designs. • The sum of the traffic on all links = Total traffic x hops C. Edward Chow

MST for 20 Node Network C. Edward Chow

MST for 20 Node Network C. Edward Chow

MST for 50 Node Network C. Edward Chow

MST for 50 Node Network C. Edward Chow

MST for 100 Node Network C. Edward Chow

MST for 100 Node Network C. Edward Chow

Traffic Volume and Costs • The traffic of 100 node MST grows 5 orders

Traffic Volume and Costs • The traffic of 100 node MST grows 5 orders of magnitude from 20 kbps of 5 node MST. • 1. 5 order of magnitude comes only from average hop count. • Problem: MSTs tend to have very long and circuitous paths. C. Edward Chow

Shortest Path Trees Definition 3. 19: Given a weighted graph (G, w) and nodes

Shortest Path Trees Definition 3. 19: Given a weighted graph (G, w) and nodes n 1 and n 2, the shortest path from n 1 to n 2 is a path such that e P w(e) is a minimum. • Segments of a shortest path are the shortest paths of their end points. (recall the optimality principle) Definition 3. 20: Given a weighted graph (G, w) and a node n 1, a shortest path tree (SPT) rooted at n 1 is a tree s. t. for any other node n 2 G, the path from n 1 to n 2 in the tree T is a shortest path between the nodes. C. Edward Chow

SPT for 20 Node Network Generate using Prim-Dijkstar with center=N 14 alpha=1. 0 MST

SPT for 20 Node Network Generate using Prim-Dijkstar with center=N 14 alpha=1. 0 MST SPT Avg(HOPS) 5. 0316 1. 9000 Max_Util 9/3/2021 0. 010 0. 002 C. Edward Chow 22

SPT vs. MST • Queueing delay and Utilization: • Let • Then • Average

SPT vs. MST • Queueing delay and Utilization: • Let • Then • Average packet delay: 20 node networks: • Average packet delay for MST= Cost=$48, 686. • Average packet delay for SPT= Cost=$88, 612. higher cost, lower delay, N 14 failure! C. Edward Chow

Prim-Dijkstra Tree • Try to find trees falls between MST and SPT. • Both

Prim-Dijkstra Tree • Try to find trees falls between MST and SPT. • Both Prim and Dijkstra algorithm start with initial label, looping over nodes to find one with smallest label, bringing it into the tree, finally relabeling all the neighbors. • Prim-Dijkstra Tree uses the following label. Where 0 1 is used to parameterize the algorithm. • =0, we build MST. =1, we build an SPT from root. C. Edward Chow

Choosing Prim-Dijkstra Trees =0. 3 and =0. 4 give attractive trees. C. Edward Chow

Choosing Prim-Dijkstra Trees =0. 3 and =0. 4 give attractive trees. C. Edward Chow

Dominace among Designs • Impose a partial ordering when picking the designs. Definition 3.

Dominace among Designs • Impose a partial ordering when picking the designs. Definition 3. 21: Given a set S and an operator that maps S x S {TRUE, FALSE}, then we call S a partial ordered set, or poset, if • For any s S, s s is FALSE. • For any s 1, s 2 S, s 1 s 2, if s 1 s 2 is True, then s 2 s 1 is FALSE. • If s 1 s 2 and s 2 s 3 are TRUE, then s 1 s 3 is TRUE. Note that there may exist 2 elements s 1, s 2 S, s. t. neither s 1 s 2 nor s 2 s 1 is TRUE. They are called incomparable. C. Edward Chow

Apply POSET to Pick Designs Definition 3. 22: Suppose D 1 has cost C

Apply POSET to Pick Designs Definition 3. 22: Suppose D 1 has cost C 1 and performance P 1. Suppose D 2 has cost C 2 and performance P 2. We will says D 1 dominates D 2, or D 1 D 2, if C 1 < C 2 and P 1 > P 2. Use the above definition, we compute the domination partial order in Table 3. 12. C. Edward Chow

Domination Partial Ordering • N 0, N 1, N 2 are dominated by others.

Domination Partial Ordering • N 0, N 1, N 2 are dominated by others. Remove them from consideration list. C. Edward Chow

Consider Marginal Cost of Delay • There are still 6 designs to consider. •

Consider Marginal Cost of Delay • There are still 6 designs to consider. • The ratio (C 1 -C 2)/(P 2 -P 1) gives the cost for delay. • $5099 buy 17 ms delay (from N 3 to N 4) the cost for delay=5099/0. 017=305329. • Between N 5 and N 6, the cost for delay rises 5 times. C. Edward Chow

Tours • Sometime trees are just too unreliable. • There are designs that are

Tours • Sometime trees are just too unreliable. • There are designs that are far more reliable, yet have only one additional link Tours. • It is a possible solution of the traveling salesman problem (TSP). Definition 3. 24: Given a set of vertices {v 1, v 2, …, vn}, a tour T is a set of n edges E s. t. each vertex v has degree 2 and the graph is connected. The tour can be represented as a permutation (vt 1, vt 2, …, vtn). There are n! such permutations. Since cyclically permuting them and the reverse permutation give the same tour , we have (n-1)!/2 tours. C. Edward Chow

TSP Problem Definition 3. 25: Given a set of vertices (v 1, v 2,

TSP Problem Definition 3. 25: Given a set of vertices (v 1, v 2, …, vn) and a distance function d: V x V R+, the traveling salesman problem is to find the tour T such that is a minimum. In this we identify vt n+1 with vt 1. C. Edward Chow

Network Reliability Definition 3. 26: The reliability of a network is the probability that

Network Reliability Definition 3. 26: The reliability of a network is the probability that the functioning nodes are connected by working links. • Assume the probability of each node working is 1 and the probability of a link falling is p. Typically p is very small. Let q = 1 – p. • For a 5 -node tree, Ptree(failure)=1 -(1 -p)4 4 p • For a 5 -node tour, Ptour(failure)=1 -((1 -p)5+5 p(1 -p)4) =1 -(q 5+5 pq 4) =10 p 2 q 3+10 p 3 q 2+5 p 4 q+p 5 substitute with terms from 1=(p+q)5 C. Edward Chow

Ptree(failure) vs. Ptour(failure) • When p=10 -6, the reliability difference is 5 orders of

Ptree(failure) vs. Ptour(failure) • When p=10 -6, the reliability difference is 5 orders of magnitude difference. C. Edward Chow

Nearest Neighbor Algorithm • Start at a root node. Set current_node = root node.

Nearest Neighbor Algorithm • Start at a root node. Set current_node = root node. • Loop until all nodes in the tour – Go through the node list, find the node closest to the current_node that is not in the tour. Let this node be best_node. – Create an edge between current_node and best_node. – Set current_node to be best_node. • Finally create an edge between the last node and root node. C. Edward Chow

What is wrong with this tour? C. Edward Chow

What is wrong with this tour? C. Edward Chow

Uncrossing the Tour First time 2 nd time C. Edward Chow

Uncrossing the Tour First time 2 nd time C. Edward Chow

Creditable Algorithms • Definition 3. 27: A heuristic optimization algorithm produces a creditable result

Creditable Algorithms • Definition 3. 27: A heuristic optimization algorithm produces a creditable result if the result is a local optimum for the problem. Otherwise, it produces an uncreditable result. • “We are asking absence of stupidity, not performance. ” • Definition 3. 28: A suite of network design problems is a set of triples (Locationsi, Traffici, Costsi) for i=1, …, |S| • Definition 3. 29: A creditability test is a program test (net, traffic, cost) that takes a network problem as input and return OK or FAIL depending on whether or not test() can manipulate net into another valid network of lower costs. • Definition 3. 30: Given a suite of network design problems S, a design algorithm A, and a creditability test t(), then C. Edward Chow

Creditability of Tours built by Nearest-Neighbor Algorithm • Test program in appendix B, generate

Creditability of Tours built by Nearest-Neighbor Algorithm • Test program in appendix B, generate a large set of locations. • Start at location 0, build a tour using N-N algorithm. • Call test_tour() to apply line-crossing test cross() O(n 2) times. • Collect the statistics. C. Edward Chow

A More Creditable N-N Heuristic Improvement 1: The closest node to the list of

A More Creditable N-N Heuristic Improvement 1: The closest node to the list of node in the tour, instead of to the last node in the list. Improvement 2: The closest node can be added to any place in the tour, not just append to the end. The insert location minimize the following formula: dist(Ni, best_node)+dist(best_node, Nj) – dist(Ni, Nj) • Intuitively, you try to find a place where Ni, best_node, Nj is as flat as possible (follow straight line). • O(2 n 2) complexity instead of O(n 2) for basic N-N algorithm. C. Edward Chow

Result of MC-NN Algorithm • Note that it performs much better. • Instead selecting

Result of MC-NN Algorithm • Note that it performs much better. • Instead selecting nearest neighbor, we can select the furthest neighbors (they are found isolated at the end of N-N algorithms and have poor choice to join the tour. C. Edward Chow

TSP Tour Do not Scale • Theorem 3. 3: Given uniform traffic any TSP

TSP Tour Do not Scale • Theorem 3. 3: Given uniform traffic any TSP tour of n nodes has avg(hops)=(n+1)/4 if n is odd, and n 2/(4(n 1) if n is even. • At 100 node tour, for the avg hop count, TSP tour is twice as bad as MST. C. Edward Chow

2 -connectivity Graph • Tour is a-connected graph. They survive the lost of a

2 -connectivity Graph • Tour is a-connected graph. They survive the lost of a node. • Definition 3. 31: Given a connected graph G=(V, E), the vertex v is an articulation point if removing the vertex and all the attached edges disconnects the graph. • In tree, any node has degree > 1 is a articulation pt. • Definition 3. 32: If a connected graph G=(V, E) has no articulation points, then the graph is 2 -connected. C. Edward Chow

Unobvious Articulation Point Easy to detect Not easy to detect C. Edward Chow

Unobvious Articulation Point Easy to detect Not easy to detect C. Edward Chow

2 -connectivity Theorem • Theorem 3. 4: Suppose G 1=(V 1, E 1) and

2 -connectivity Theorem • Theorem 3. 4: Suppose G 1=(V 1, E 1) and G 2=(V 2, E 2) are 2 connected graphs with V 1 V 2 = . Let v 1, v 2 V 1 and v 3, v 4 V 2. Then the graph G with vertices V 1 V 2 and Edges E 1 E 2 (v 1, v 3) (v 2, v 4) is 2 -connected. • Divide and Conquer: Divide the nodes into clusters, find the tour for each cluster, treat a cluster a node and connect clusters with a ring of edges that do not share the same vertex. • Note that for n clusters, the connected tours will have n more edges (more reliable) and shorter average hop count. C. Edward Chow

Original 20 -node Tour C. Edward Chow

Original 20 -node Tour C. Edward Chow

2 Cluster Tour C. Edward Chow

2 Cluster Tour C. Edward Chow

Join the Tours C. Edward Chow

Join the Tours C. Edward Chow

Theorem 3. 5 Suppose that G=(V, E) is a 2 -connected graph with |V|

Theorem 3. 5 Suppose that G=(V, E) is a 2 -connected graph with |V| > 2. Suppose that each node vi V is replaced by a 2 connected graph Gi. Suppose each edge e=(u, w) E is replaced by an edge e’ from u’ Gu to v’ Gw. Then if no 2 of these replacement edges have a common vertex, the graph H=( i. Vi, i. Ei E’) is a 2 connected graph. C. Edward Chow

4 -cluster Design for 50 nodes Single tour: HOP=12. 755 4 -cluster: HOP=6. 8971

4 -cluster Design for 50 nodes Single tour: HOP=12. 755 4 -cluster: HOP=6. 8971 C. Edward Chow

Exercise #6 Problem 1. Network Restoration. a. For link A-G cut, show the restoration

Exercise #6 Problem 1. Network Restoration. a. For link A-G cut, show the restoration paths (route as sequence of nodes, and its restored bandwidth. b. Discuss the selection trade-off for the two algorithms at Page 5 handout. Problem 2. Tree and Tour. a. Problem 3. 7. 1. Explain why for the 20 -node random problem avg(hops)SPT=1. 9000. 2. Prove for a start on n nodes, S, that avg(hops)S=2 -2/n. b. Download the g 20 sw. * from ~cs 622/public_html/delite. Run delite with 1. Tour (Nearest Neighbor), 2. Tour (Furthest Neighbor), 3. Prim, 4. SPT. Compare the cost, avg(hops), and max. utilization of these four designs. C. Edward Chow

Solution to EX 6 Problem 1. Network Restoration a. For link A-G cut, show

Solution to EX 6 Problem 1. Network Restoration a. For link A-G cut, show the restoration paths (route as sequence of nodes, and its restored bandwidth. Ans: 8 working channels lost. 3 restoration paths through AF. 3 restoration paths through ACEF 1 restoration path through ABDEF b. Discuss the selection trade-off for the two algorithms at Page 5 handout. Ans: Depends on the restoration deadline and whether restoration paths are needed earlier for the priority traffic. If the restoration level is the utmost important metric, then the final restoration level at the restoration deadline decides the selection of the algorithm. The curve however does not show the spare channel usage. C. Edward Chow

Solution to HW 5 (2) Problem 2. Tree and Tour. a. Problem 3. 7.

Solution to HW 5 (2) Problem 2. Tree and Tour. a. Problem 3. 7. 1. Explain why for the 20 -node random problem avg(hops)SPT=1. 9000. 2. Prove for a star on n nodes, S, that avg(hops)S=2 -2/n. Ans 1: There are c(20, 2)=20*19/2=190 connections. Among them, 19 are to the star. avg(hops)spt=((190 -19)*2+19*1)/190=1. 9 Ans 2: There are c(n, 2)=n*(n-1)/2 connections. Among them, n-1 are to the star. Avg(hops)S=(n*(n-1)/2 -(n-1))*2+(n-1))/(n*(n-1)/2) =(n*(n-1)-(n-1))/(n*(n-1)/2)=2*(n-1)/n=2 -2/n. b. Download the g 20 sw. * from ~cs 622/public_html/delite. Run delite with 1. Tour (Nearest Neighbor), 2. Tour (Furthest Neighbor), 3. Prim, 4. SPT. Compare the cost, avg(hops), and max. utilization of these four designs. C. Edward Chow

Delite Tool Analysis (Tour NN) C. Edward Chow

Delite Tool Analysis (Tour NN) C. Edward Chow

Tour (Furthest Neighbor) C. Edward Chow

Tour (Furthest Neighbor) C. Edward Chow

PRIM C. Edward Chow

PRIM C. Edward Chow

SPT C. Edward Chow

SPT C. Edward Chow

Network Design Comparison Network Design Cost Avg Hop Count Max Utilization Tour Nearest Neigbbor

Network Design Comparison Network Design Cost Avg Hop Count Max Utilization Tour Nearest Neigbbor 62732 5. 2632 0. 005 Tour Further Neighbor 55061 5. 2623 0. 005 Prim (MST) 48610 5. 0316 0. 010 SPT 103650 1. 9 C. Edward Chow 0. 002