Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "TCOM 540/11 TCOM 540 Session 2. TCOM 540/12 Web Page OM540541.htm."— Presentation transcript:

1 TCOM 540/11 TCOM 540 Session 2

2 TCOM 540/12 Web Page http://teal.gmu.edu/ececourses/tcom540/TC OM540541.htm

3 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

4 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

5 TCOM 540/15 Set Theory (3) Intersection Union

6 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)}

7 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

8 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

9 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

10 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

11 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

12 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

13 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

14 TCOM 540/114 Tree, Star, Chain

15 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]

16 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

17 TCOM 540/117 Node Locations

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

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

20 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

21 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

22 TCOM 540/122 Kruskal’s Algorithm for MST (2) 27 30 25 26 21 29 31

23 TCOM 540/123 Kruskal’s Algorithm for MST (2) 27 30 25 26 21 1 st add 21 29 31

24 TCOM 540/124 Kruskal’s Algorithm for MST (2) 27 30 25 26 21 1 st add 21 2 nd add 25 21 29 31

25 TCOM 540/125 Kruskal’s Algorithm for MST (2) 27 30 25 26 21 1 st add 21 2 nd add 3 rd add 25 21 27 25 21 29 31

26 TCOM 540/126 Kruskal’s Algorithm for MST (2) 27 30 25 26 21 1 st add 21 2 nd add 3 rd add 25 21 27 25 21 29 4th add 27 25 21 29 31

27 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

28 TCOM 540/128 Prim’s Algorithm for MST (2) 27 30 25 26 21 29 31 Choose as root

29 TCOM 540/129 Prim’s Algorithm for MST (2) 27 30 25 26 21 29 31 Choose as root 27 1 st Add

30 TCOM 540/130 Prim’s Algorithm for MST (2) 27 30 25 26 21 29 31 Choose as root 27 1 st Add 27 21 2 nd Add

31 TCOM 540/131 Prim’s Algorithm for MST (2) 27 30 25 26 21 29 31 Choose as root 27 1 st Add 27 21 2 nd Add 27 25 21 3 rd Add

32 TCOM 540/132 Prim’s Algorithm for MST (2) 27 30 25 26 21 29 31 Choose as root 27 1 st Add 27 21 2 nd Add 27 25 21 3 rd Add 27 25 21 29 4 th Add

33 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

34 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)

35 TCOM 540/135 MSTs Do Not Scale (2)

36 TCOM 540/136 MSTs Do Not Scale (3)

37 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

38 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

39 TCOM 540/139 Dijkstra Example Choose as root 1 2 5 3 27 30 25 1 21 4 29 31

40 TCOM 540/140 Dijkstra Example Choose as root 1 & 2. Nodes adjacent to root 1 2 5 27 30 Label = 27 Label = 30 1 2 5 3 27 30 25 1 21 4 29 31

41 TCOM 540/141 Dijkstra Example Choose as root 1 2 5 27 30 Label = 27 Label = 30 3. Nodes adjacent to 2 1 2 5 27 Label = 28 1 2 5 3 27 30 25 1 21 4 29 31 1 1 & 2. Nodes adjacent to root 3 21 Label = 48

42 TCOM 540/142 Dijkstra Example 1 2 5 3 27 1 4 31 Choose as root 4&5. Nodes adjacent to 5 1 2 5 3 27 30 25 26 21 4 29 31 Label = 59 1 2 5 27 30 Label = 27 Label = 30 3&4. Nodes adjacent to 2 1 2 5 27 Label = 28 1 1 & 2. Nodes adjacent to root 3 21 Label = 48 25 Label = 53

43 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

44 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

45 TCOM 540/145 Varying Alpha

46 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

47 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

48 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

49 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

50 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

51 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 ….

52 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

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

54 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

55 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

56 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

57 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

58 TCOM 540/158 Heuristic Based on Partitioning

59 TCOM 540/159 Heuristic Based on Partitioning Select clusters

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

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

62 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)


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

Similar presentations


Ads by Google