TCOM 540/11 TCOM 540 Session 2. TCOM 540/12 Web Page OM540541.htm.

Slides:



Advertisements
Similar presentations
Lecture 15. Graph Algorithms
Advertisements

22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Great Theoretical Ideas in Computer Science for Some.
CP3397 Network Design and Security Lecture 4 WAN design - Principles and practice.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
1 Greedy 2 Jose Rolim University of Geneva. Algorithmique Greedy 2Jose Rolim2 Examples Greedy  Minimum Spanning Trees  Shortest Paths Dijkstra.
Great Theoretical Ideas in Computer Science.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
1 Spanning Trees Lecture 20 CS2110 – Spring
Chapter 9 Graph algorithms. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
CSE 421 Algorithms Richard Anderson Dijkstra’s algorithm.
Chapter 9: Greedy Algorithms The Design and Analysis of Algorithms.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
The Shortest Path Problem
1 Minimum Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
1 Minimum Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting.
Data Structures Using C++ 2E
IS 2610: Data Structures Graph April 5, 2004.
1 GRAPHS - ADVANCED APPLICATIONS Minimim Spanning Trees Shortest Path Transitive Closure.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
Copyright © Cengage Learning. All rights reserved.
1 TCOM 5143 Telecommunications Analysis, Planning and Design Lecture 6 Network Design and Graph Theory: part 2 Shortest Path trees and Tours.
1 TCOM 541 Session 1. 2 Agenda Overview Recap TCOM540 material needed for this course.
SPANNING TREES Lecture 21 CS2110 – Spring
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
COSC 2007 Data Structures II Chapter 14 Graphs III.
UNC Chapel Hill Lin/Foskey/Manocha Minimum Spanning Trees Problem: Connect a set of nodes by a network of minimal total length Some applications: –Communication.
7.1 and 7.2: Spanning Trees. A network is a graph that is connected –The network must be a sub-graph of the original graph (its edges must come from the.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Chapter 3 Graphs, Trees, and Tours Presented by Qibin Cai.
Slide 1 Chapter 9 Mesh Network Design - II. Slide 2 Mesh Network Design The design of backbone networks is governed by 3 goals: nDirect path between source.
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
Graph Theory and Applications
SPANNING TREES Lecture 20 CS2110 – Fall Spanning Trees  Definitions  Minimum spanning trees  3 greedy algorithms (incl. Kruskal’s & Prim’s)
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
SPANNING TREES Lecture 21 CS2110 – Fall Nate Foster is out of town. NO 3-4pm office hours today!
Chapter 9: Graphs.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Approximation Algorithms by bounding the OPT Instructor Neelima Gupta
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
1 Data Structures and Algorithms Graphs. 2 Graphs Basic Definitions Paths and Cycles Connectivity Other Properties Representation Examples of Graph Algorithms:
Minimum Spanning Trees
Greedy Technique.
Minimum Spanning Trees
Graph theory Definitions Trees, cycles, directed graphs.
Spanning Trees Lecture 21 CS2110 – Fall 2016.
Great Theoretical Ideas in Computer Science
Graph Theory A loop is an edge where both endpoints are the same
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Discrete Mathematics for Computer Science
Minimum Spanning Trees
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
Shortest Path.
Autumn 2015 Lecture 10 Minimum Spanning Trees
Richard Anderson Lecture 10 Minimum Spanning Trees
Autumn 2016 Lecture 10 Minimum Spanning Trees
Winter 2019 Lecture 11 Minimum Spanning Trees (Part II)
Spanning Trees Lecture 20 CS2110 – Spring 2015.
Winter 2019 Lecture 10 Minimum Spanning Trees
Chapter 9 Graph algorithms
Minimum Spanning Trees
Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II)
Presentation transcript:

TCOM 540/11 TCOM 540 Session 2

TCOM 540/12 Web Page OM htm

TCOM 540/13 Set Theory A set is a collection of (mathematical) objects –E.g., {A, B, C} –E.g., {1,2,3, …, 99} s  S means “s is a member of S” s ~  S means “s is not a member of S” T is a subset of S if every member of T is also a member of S –It’s a proper subset if there is at least one member of S that is not a member of T

TCOM 540/14 Set Theory (2) The set of all subsets of S is denoted as 2 s If S has n members, then 2 s has 2 n members Union of two sets is the set of all their members Intersection of two sets is the set of common members

TCOM 540/15 Set Theory (3) Intersection Union

TCOM 540/16 Set Theory (4) Cartesian Product of two sets, S and T, is the set SxT –Elements are (s,t) where s  S and t  T The graph of a function f:S T is the subset of SxT that consists of {(s,t) f(s) = t)}

TCOM 540/17 Graphs A graph consists of a set of vertices (or nodes) V and a set of edges E A D I Z C B

TCOM 540/18 Some Definitions for Graphs Each edge connects two vertices (may be same – then it’s called a loop) Two edges are called parallel if they connect the same vertices A graph is simple if it has no loops or parallel edges The degree of a vertex is the number of edges it has Two nodes are adjacent if there is an edge that has them as endpoints

TCOM 540/19 Some Definitions for Graphs (2) A path between vertices v 1 and v n is a set of edges (e 1, e 2, …, e n ) such that e i and e i+1 have a common endpoint, and v 1 is an endpoint of e 1 and v n is an endpoint of e n A cycle is a path from a vertex to itself A graph is connected if for any two nodes there is a path between them

TCOM 540/110 A Small (But Not Simple) Graph A D I Z C B Parallel edges Loop Node degree 3 Adjacent nodes (DZ), (ZB), (BI), (ID) is a cycle. This graph is connected

TCOM 540/111 Definitions (3) A subgraph G* of a graph G with vertices V and edges E is a pair (V*, E*) where –V* is a subset of V –E* is a subset of E –If an edge belongs to E* then both its endpoints must belong to V* A component of a graph is a maximal connected subgraph Two graphs G1, G2 are isomorphic if there is a 1-to-1 mapping f:V1 V2 such that (v1, v2) is a member of E1 iff (f(v1), f(v2)) is a member of E2

TCOM 540/112 Another Graph A D I Z C N K M J e1 e2 e3 e4 e5 e6 e7 e8 ( (D, Z, B, M, J), (e2, e8, e4)) is a subgraph It is not a component. The two right-hand components are isomorphic X Q R H e11 e99 P e15 e16 e12 B e13 e9

TCOM 540/113 Definitions (4) A tree is a connected simple graph without cycles A star is a tree in which exactly one node has degree >1 A chain is a tree in which no node has degree greater than 2 Define N(G) = number of nodes in G

TCOM 540/114 Tree, Star, Chain

TCOM 540/115 V&H Coordinates V&H coordinate grid covers U.S. Approx 10,000 x 10,000 Distance between points (v1, h1) and (v2, h2) for tariff calculations is sometimes defined as: A simpler formulation is: Note V&H assumes earth is flat … Dist = 1+int{[(dv 2 +9)/10+(dh 2 +9 )/10] 0.5 } Where dv = v1-v2 and dh = h1-h2 Dist = 1 + int[(dv 2 +dh 2 )/10]

TCOM 540/116 Latitude and Longitude V&H used primarily in North America Most of world uses latitude and longitude (L&L) Distances between points in L&L coordinates are computed using spherical geometry

TCOM 540/117 Node Locations

A Real Network (Backbone Not Shown) Vendor A Cost: $1.159M Vendor B Cost: $1.213M 164 Hosts

TCOM 540/119 Real Network Detail (Atlanta, GA) Stand Alone Hosts

TCOM 540/120 Weighted Graph A weighted graph is a graph G where each edge e has a weight w(e) –Denoted by (G, w) –Generally w(e) > 0 –Weight of a subgraph G* is sum of weights of edges in G* Real networks are weighted graphs –Weight may be cost, delay, or other parameter Minimum spanning tree (MST) is a connected subgraph with minimum weight

TCOM 540/121 Kruskal’s Algorithm for MST Is G connected? yes no stop Sort edges in ascending order of weight Mark each node as Separate component Loop on edges Let e be candidate edge If ends of e are in different components, accept e Stop when number of edges = N(G) - 1

TCOM 540/122 Kruskal’s Algorithm for MST (2)

TCOM 540/123 Kruskal’s Algorithm for MST (2) st add

TCOM 540/124 Kruskal’s Algorithm for MST (2) st add 21 2 nd add

TCOM 540/125 Kruskal’s Algorithm for MST (2) st add 21 2 nd add 3 rd add

TCOM 540/126 Kruskal’s Algorithm for MST (2) st add 21 2 nd add 3 rd add th add

TCOM 540/127 Prim’s Algorithm for MST Start with all nodes unconnected and Label = infinity Select root node Scan neighbors, update Labels = min edge to tree Add closest neighbor (smallest Label) Stop when N(G) –1 added

TCOM 540/128 Prim’s Algorithm for MST (2) Choose as root

TCOM 540/129 Prim’s Algorithm for MST (2) Choose as root 27 1 st Add

TCOM 540/130 Prim’s Algorithm for MST (2) Choose as root 27 1 st Add nd Add

TCOM 540/131 Prim’s Algorithm for MST (2) Choose as root 27 1 st Add nd Add rd Add

TCOM 540/132 Prim’s Algorithm for MST (2) Choose as root 27 1 st Add nd Add rd Add th Add

TCOM 540/133 Limitations of MSTs No redundancy –One link failure separates the network into two disconnected components –Big problem for large networks May involve very long paths in large networks

TCOM 540/134 MSTs Do Not Scale Number of hops between nodes n1 and n2 is the number of edges in the path chosen by the routing algorithm Average number of hops is traffic-weighted = (  n1,n2 traffic(n1,n2)*hops(n1,n2))/  n1,n2 traffic(n1,n2)

TCOM 540/135 MSTs Do Not Scale (2)

TCOM 540/136 MSTs Do Not Scale (3)

TCOM 540/137 Definitions For a weighted graph (G,w), and nodes n1 and n2, the shortest path P from n1 to n2 minimizes  e  P w(e) The shortest-path tree (SPT) rooted at node n1 is a tree T such that for any other node n2 the path from n1 to n2 is a shortest path

TCOM 540/138 Dijkstra’s Algorithm for Shortest-Path Trees 1.Mark each node unscanned, assign label infinity 2.Set label of root to 0, and predecessor to self 3.Loop through nodes Find node n with smallest label Mark as scanned Examine all adjacent nodes m, see if distance through n < label If so, update label, update predecessor(m) = n Note that a link may drop out of the tree if a shorter route is found

TCOM 540/139 Dijkstra Example Choose as root

TCOM 540/140 Dijkstra Example Choose as root 1 & 2. Nodes adjacent to root Label = 27 Label =

TCOM 540/141 Dijkstra Example Choose as root Label = 27 Label = Nodes adjacent to Label = & 2. Nodes adjacent to root 3 21 Label = 48

TCOM 540/142 Dijkstra Example Choose as root 4&5. Nodes adjacent to Label = Label = 27 Label = 30 3&4. Nodes adjacent to Label = & 2. Nodes adjacent to root 3 21 Label = Label = 53

TCOM 540/143 Characteristics of SPTs In a complete graph, SPT is a star* –High performance and reliability –But likely implies low link utilization, high expense * Unless triangle inequality does not hold

TCOM 540/144 Prim-Dijkstra Trees We play with the definition of the Label Prim’s Label = min neighbors dist(node, neighbor) Dijkstra’s Label = min neighbors [dist(root, neighbor) + dist(neighbor, node)] Prim-Dijkstra Label = = min neighbors [  *dist(root, neighbor) + dist(neighbor, node)] Now  is a parameter that we choose, between 0 and 1

TCOM 540/145 Varying Alpha

TCOM 540/146 Tours A tree design may be unreliable A tour adds one link to significantly increase reliability A tour of a set of vertices (v1, v2, …, vn) is a set of n edges such that each vertex has degree 2 and the graph is connected

TCOM 540/147 Tours (2) Leads to the (in)famous Traveling Salesman Problem (TSP) –Given a set of vertices (v1, v2, …, vn) and a distance function d(vi,vj) between vertices, find the tour T(vt i ) such that  d(vt i,t i+1 ) is minimized

TCOM 540/148 Reliability of a Tree Reliability = probability that functioning nodes are connected by working links For a tree, reliability = (1-p) n-1, where –p = probability of a link failing –n = number of nodes P(failure) = 1- reliability = 1 - (1-p) n-1  (n-1)*p

TCOM 540/149 Reliability of a Ring A ring can tolerate one failure For a ring, P(failure) = 1- (1-p) n – n*p*(1-p) n-1  0.5*n*(n-1)*p 2 if p is small X

TCOM 540/150 A Simple Algorithm for Building a Tour Denote a root node, set current node = root Loop through nodes –Find closest node (not in tour) to current node –Add an edge to it –Reset current node to be this node just added Create an edge between last node and root

TCOM 540/151 Creditable Solutions and Creditability Tests A solution is creditable if it is a local optimum –I.e., it is not creditable if, by some method, we can manipulate the solution to a better one Cahn uses a crossing test to determine creditability of the simple tour-building algorithm –It does not do well ….

TCOM 540/152 A Better Tour-Building Algorithm Look for closest neighbor to any node in the partial tour (not just the last one added) Insert between two adjacent nodes in tour in “best” place –Minimum increase in partial tour length Also “farthest neighbor” heuristic –Avoids stranding distant nodes

TCOM 540/153 A Difficulty TSP tours do not scale –Similar to trees in this respect –Average number of hops increases O(n)

TCOM 540/154 2-Connectivity A vertex v of a connected graph G = (V, E) is an articulation point if removing the vertex and all attached edges disconnects the graph If a connected graph has no articulation points, it is said to be 2-connected

TCOM 540/155 Connecting 2-Connected Graphs Suppose G1 = (V1, E1) and G2 = (V2, E2) are two disjoint 2-connected graphs. Take v1 and v2 from G1 and v3 and v4 from G2 and add the edges (v1,v3) and (v2,v4). The resulting graph is 2-connected

TCOM 540/156 Connecting 2-Connected Graphs Suppose G1 = (V1, E1) and G2 = (V2, E2) are two disjoint 2-connected graphs. Take v1 and v2 from G1 and v3 and v4 from G2 and add the edges (v1,v3) and (v2,v4). The resulting graph is 2-connected Roughly, if you connect 2 pairs of vertices from two 2-connected graphs, the resulting graph is 2-connected

TCOM 540/157 Heuristic Based on Partitioning Divide set of nodes into multiple “clusters” Use nearest-neighbor algorithm to build TSP tour on each cluster Connect clusters, ensuring no connectors have a common vertex Resulting graph is 2-connected

TCOM 540/158 Heuristic Based on Partitioning

TCOM 540/159 Heuristic Based on Partitioning Select clusters

TCOM 540/160 Heuristic Based on Partitioning Select clusters Develop TSPs

TCOM 540/161 Heuristic Based on Partitioning Select clusters Develop TSP tours Join clusters

TCOM 540/162 Homework Read Chapter 4 of Cahn Do exercises 2.8, 2.9, 3.1, 3.8 (note: there seem to be typos here – use figure 3.9, and extend table 3.15)