Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spanning Trees in Communication Networks Rui Campos INESC Porto, Faculdade de Engenharia, Universidade do Porto

Similar presentations


Presentation on theme: "Spanning Trees in Communication Networks Rui Campos INESC Porto, Faculdade de Engenharia, Universidade do Porto"— Presentation transcript:

1 Spanning Trees in Communication Networks Rui Campos INESC Porto, Faculdade de Engenharia, Universidade do Porto rcampos@inescporto.pt

2 Outline 1.Graph Theory 2.Spanning Trees 3.Algorithms 4.Spanning Trees Applications 5.Summary

3 About me PhD student at University of Porto PhD Overview Auto-configuration and Self-management of Personal Area Networks considering: intra- and extra-PAN connectivity heterogeneity in IP networks integration of multiple communication technologies Researcher at INESC Porto Participation in FP6 Ambient Networks Project 1st phase - protocol design, specification, and simulation 2nd phase – automatic and dynamic IP connectivity establishment between Ambient Networks

4 1. Graph Theory Graph formal definition: A graph G=(V,E,w) is defined as a set of vertices V connected by a set of edges E=[V] 2 (i.e., the elements of E are 2-element subsets of V) with weights w that represent costs assigned to the edges of G.

5 1. Graph Theory [example graph]

6 1. Graph Theory [some definitions] Number of vertices in G is n = |V| Number of edges in G is m = |E| Degree of a vertex v is defined as its number of adjacent edges (an adjacent edge to v is an edge connecting it to a neighbor vertex) Path in G is defined as a sequence of connected adjacent vertices Cost of path is equal to sum of weights of edges belonging to path Cycle in G is defined as a path where first and last vertex in sequence are the same

7 1. Graph Theory [graph types] undirectedundirected weighted

8 directeddirected weighted 1. Graph Theory [graph types]

9 complete graphmetric graph 1. Graph Theory [specific types] all vertices have degree n-1edge weights satisfy triangle inequality

10 spanning tree 1. Graph Theory [specific types] tree with n-1 edges extracted from a graph G with n vertices tree graph without cycles

11 2. Spanning Trees [cost functions] Path cost e.g., c T (1,3)=5+2=7 Total cost C total (T)=5+2+1=8 Routing Cost C r (T)= c T (1,2)+c T (1,3)+c T (1,4)+c T (2,1)+c T (2,3)+c T (2,4) + c T (3,1)+c T (3,2)+c T (3,4)+c T (4,1)+c T (4,2)+c T (4,3)=48

12 2. Spanning Trees [types] Shortest Path Tree (SPT) Minimum Spanning Tree (MST) Minimum Routing Cost Tree (MRCT) path cost total cost routing cost

13 2. Spanning Trees [SPT] The Shortest Path Tree (SPT) rooted at a vertex s defines a tree composed by union of the shortest paths between s and each of the other vertices in G such that:

14 2. Spanning Trees [SPT] Let’s see an example … SPT root at vertex 1: P(1,4) = (1,2,4) ; C(1,4) = 14 P*(1,4) = (1,2,3,4) ; C*(1,4) = 14 P**(1,4) = (1,3,2,4) ; C**(1,2) = 7 P***(1,4) = (1,3,4) ; C***(1,4) = 5 P(1,3) = (1,3) ; C(1,3) = 2 P*(1,3) = (1,2,3) ; C*(1,3) = 11 P**(1,3) = (1,2,4,3) ; C**(1,3) = 17 P(1,2) = (1,2) ; C(1,2) = 10 P*(1,2) = (1,3,2) ; C*(1,2) = 3 P**(1,2) = (1,3,4,2) ; C**(1,2) = 9

15 2. Spanning Trees [SPT] SPT root at vertex 1: P*(1,2) = (1,3,2) P(1,3) = (1,3) P***(1,4) = (1,3,4)

16 2. Spanning Trees [MST] The Minimum Spanning Tree (MST) represents the spanning tree T* such that: for all spanning trees T that can be computed from G

17 2. Spanning Trees [MST] Let’s see an example... STs that can be computed from graph: C total = 3+2+4 = 9 C total = 2+4+5 = 11 C total = 3+5+4 = 12 C total = 2+3+5 = 11

18 2. Spanning Trees [MRCT] The Minimum Routing Cost Tree (MRCT) represents the spanning tree T* such that: for all spanning trees T that can be computed from G Note: computation of exact MRCT is a NP-hard problem

19 2. Spanning Trees [MRCT] Let’s see an example … STs that can be computed from graph: C r = 2+4+5+2+6+3 +4+6+9+5+3+9=58 C r = 2+4+9+2+6+11 +4+6+5+9+11+5=74 C r = 12+4+9+12+8+3 +4+8+5+9+3+5=82 C r = 2+10+5+2+8+3 +10+8+5+5+3+5=66

20 2. Spanning Trees [MRCT] Using other routing cost definition … STs that can be computed from graph: C r = 2+4+5+6+3+9=29 C r = 2+4+9+6+11+5=37 C r = 12+4+9+8+3+5=41 C r = 2+10+5+8+3+5=33

21 2. Spanning Trees [other types] MRCT considering communication requirement (MRCT is optimal when communication requirements are equal) Steiner Minimal Tree (SMT) –spans only a given subset of vertices in a graph G –minimizes same cost functions as MST Minimum Diameter Spanning Tree (MDST) –diameter = cost of longest path between any two vertices in a tree –defines spanning tree of minimum diameter among all possible spanning trees Note: other types and further details can be found in [1]

22 2. Spanning Trees [2 interesting cases] When edge weights of G are highly heterogeneous  MST = MRCT =  SPT (*) When there is a single source s  MRCT = SPT s (*) P. Mieghem, S. Langen, Influence of the link weight structure on the shortest path, Physical Review E 71 (2005) 056113-1–056113-13. P. Mieghem, S. M. Magdalena, Phase transition in the link weight structure of networks, Physical Review E 72 (2005) 056138-2–056138-7.

23 2. Spanning Trees [MST=MRCT=SPT] Let’s see an example... STs that can be computed from graph: C r =64; C total =21C r =46; C total =21 C r =64; C total =21 C r =36; C total =12 C r =10; C total =3C r =64; C total =21 SPT

24 3. Algorithms [Prim’s algorithm] Algorithm to compute MST for a graph G Proposed by Robert Prim in 1957 Time complexity O(n.m) –in its more naive implementation O(m.log(n)) –using binary heaps in conjunction with adjacency lists O(m+n.log(n)) –using Fibonacci heaps in conjunction with adjacency lists

25 Algorithm: PRIM Input: A weighted, undirected graph G=(V,E,w) Output: A minimum spanning tree T T ← 0 Let u  V be an arbitrary vertex U ← {u} while |U| < n do find u  U and v  (V - U) such that edge (u,v) is the smallest edge between U and V – U and does not form a cycle T ← T  {(u,v)} U ← U  {v}

26 3. Algorithms [Prim’s algorithm] Steps in a nutshell: (T ← 0) 1.Pick up arbitrary vertex v 2.Select edge (i,j) adjacent to v with lowest weight and add it to T 3.Select adjacent edge (i,j) to T with lowest weight that does not form a cycle and add it to T 4.Repeat step 3 until all vertices have been spanned

27 3. Algorithms [Prim’s algorithm] input graphMST Let’s see an example...

28 3. Algorithms [Prim’s algorithm] input graphMST Other possible result...

29 3. Algorithms [Kruskal’s algorithm] Algorithm to compute MST for a graph G Proposed by Joseph Kruskal in 1956 Time complexity O(m.log(m)) –using priority queues

30 Algorithm: KRUSKAL Input: A weighted, undirected graph G=(V,E,w) Output: A minimum spanning tree T Sort edges in E in nondecreasing order by weight T ← 0 Create one set for each vertex for each edge (u,v) in sorted order do if FIND_SET(u)  FIND_SET(v) then T ← T  {(u,v)} UNION(u,v) MAKE_SET(v) create a new set whose only member is v FIND_SET(v)returns a pointer to set containing v UNION(u,v) unites dynamic sets that contain u and v into new set that is union of these two sets Legend

31 3. Algorithms [Kruskal’s algorithm] Steps in a nutshell: (T ← 0) 1.Pick up edge (i,j) with lowest weight that does not belong to T and does not form a cycle 2.Add edge (i,j) to T 3.Repeat step 1 and 2 until all vertices have been spanned

32 3. Algorithms [Kruskal’s algorithm] input graphMST Let’s see an example...

33 3. Algorithms [Dijkstra’s algorithm] Algorithm to compute SPT for a graph G Proposed by Edsger Dijkstra in 1959 Time complexity O(n 2 ) –in its more naive implementation O(m.log(n)) –using binary heaps O(m+nlog(n)) –using Fibonacci heaps

34 Algorithm: DIJKSTRA Input: A weighted, directed graph G=(V,E,w); a source vertex s. Output: A shortest path tree T rooted at s for each v  V do δ v ←  ; p v ← NIL δ s ← 0; T ← 0; S ← V while S  0 do choose u  S with min(δ u ) S ← S – {u} if u  s then T ← T  {(p u,u)} for each vertex v adjacent to u do if (δ v  δ u + w(u,v)) then δ v ← δ u + w(u,v) p v ← u

35 3. Algorithms [Dijkstra’s algorithm] Steps in a nutshell: (T ← 0; δ v ←  ; δ s ← 0) 1.Select vertex v with min shortest path estimate and add edge (p v,v) to T 2.Re-evaluate shortest path estimates of vertices adjacent to v and update them and parent vertex in T if lower estimates are obtained 3.Repeat steps 1 and 2 until all vertices have been spanned

36 3. Algorithms [Dijkstra’s algorithm] input graph Let’s see an example... SPT rooted@vertex 1 vδvδv 21 310 vδvδv 3 54 vδvδv 3 46 vδvδv 39 67 vδvδv 39

37 3. Algorithms [Bellman-Ford algorithm] Algorithm to compute SPT for a graph G Proposed by Richard Bellman in 1958 Works in more general cases finds SPT even when graph has negative weights Time complexity O(n.m)

38 Algorithm: BELLMAN-FORD Input: A weighted, directed graph G=(V,E,w); a source vertex s. Output: A shortest path tree T rooted at s for each v  V do δ v ←  ; p v ← NIL δ s ← 0 for i ← 1 to n-1 do for each (u,v)  E do if (δ v  δ u + w(u,v)) then δ v ← δ u + w(u,v); p v ← u for each (u,v)  E do if (δ v  δ u + w(u,v)) then Output “A negative cycle exists”; Exit T ← 0 for v  (V-s) do T ← T  {(p u,u)}

39 3. Algorithms [Bellman-Ford algorithm] Steps in a nutshell: (T ← 0; δ v ←  ; δ s ← 0) 1.For each edge (u,v) re-evaluate shortest path estimate δ v and update it and p v if (δ u + w(u,v)  δ v ) 2.Repeat step 1 (n-1) times 3.The union of edges (p v,v) gives shortest path tree T

40 3. Algorithms [Bellman-Ford algorithm] input graph Let’s see an example... SPT rooted@vertex 2 v1234 δvδv  0  pvpv NIL v1234 δvδv 20  3 pvpv 2 2 E={(1,2),(2,1),(1,3),(3,1),(2,4),(4,3)} v1234 δvδv 20123 pvpv 2NIL12 Re-evaluation: for each (u,v)  E do if (δ u + w(u,v)  δ v ) then δ v ← δ u + w(u,v) SPT_rooted@2 v1234 δvδv 2063 pvpv 2NIL42

41 3. Algorithms [Add algorithm] Algorithm for finding approximate MRCT for a graph G Proposed by Vic Grout in 2005 Vertex oriented version of Prim’s algorithm minimizes number of relay nodes in final spanning tree Time complexity O(n.log(n)) time in the worst case –usually, faster due to tendency for many nodes to be added to T at each step

42 Algorithm: ADD Input: undirected graph G=(V,E) Output: approximate minimum routing cost tree T T ← 0 for all v  V s v ← 0 for all u,v  V w uv ← 0 find u such that d u ← max(d v ), v  V s u ← 1 while there exists j such that s j = 0 do for each v  V adjacent to u do w uv ← 1; s v ← 1; T ← T  {(p u,u)} find u such that (d u − δ u ) ← max(d j − δ j ) where s j = 1 Legend: s v =1  v  T w uv – weight of edge (u,v) d u – degree of vertex u δ u – degree of vertex u in T

43 3. Algorithms [Add algorithm] Steps in a nutshell: 1.Pick up vertex v adjacent to maximum number of unspanned vertices 2.Add to T all edges adjacent to v that do not form a cycle 3.Repeat steps 1 and 2 until all vertices are added to T

44 3. Algorithms [Add algorithm] input graph approximate MRCT Let’s see an example...

45 3. Algorithms [Wong’s algorithm] Proposed by Richard Wong in 1980 2-approximate MRCT algorithm Based on Dijkstra’s algorithm Time complexity O(n 2.log(n)+m.n)

46 3. Algorithms [Wong’s algorithm] Steps: 1.Compute n SPTs using Dijkstra’s algorithm 2.Compute routing cost for each SPT 3.Select SPT with lowest routing cost 2-approximate MRCT

47 3. Algorithms [Wong’s algorithm] Let’s see an example... SPT_rooted@1 SPT_rooted@2 SPT_rooted@3 SPT_rooted@4 SPT_rooted@5 SPT_rooted@6 SPT_rooted@7 SPT_rooted@8

48 3. Algorithms [Wong’s algorithm] Let’s see an example... SPT rootRouting Cost 1124 2136 3118 4122 5144 6126 7134 8142 approximate MRCT

49 4. Spanning Trees Applications Minimum Spanning Tree (MST) cable TV network cost-efficient connection of several end clients to infrastructure islands connection cost-efficient connection of islands using bridges travelling salesman problem NP-hard problem MST can be used to find 2-approximate solution

50 4. Spanning Trees Applications Shortest Path Tree (SPT) routing protocols Routing Information Protocol (RIP) Open Shortest Path First (OSPF) Ad-hoc On-demand Distance Vector (AODV) Optimized Link State Routing (OLSR) multicast routing minimization of path cost between source and destinations road network find shortest path between a city and other cities in a country

51 4. Spanning Trees Applications Minimum Routing Cost Tree (MRCT) Ethernet networks minimization of routing cost between bridges/switches road network connection of cities in a country with minimum distance between cities

52 5. Summary Different types of graphs defined undirected, undirected weight, directed, directed weighted Specific graph types complete graph, metric graph, tree, spanning tree Different types of spanning trees Shortest Path Tree (SPT) Minimum Spanning Tree (MST) Minimum Routing Cost Tree (MRCT) ↓ their computation by exhaustive search is impratical

53 5. Summary Spanning tree algorithms Enable efficient computation of spanning trees Spanning trees have several applications Spanning TreeAlgorithm MST Prim Kruskal SPT Dijkstra Bellman-Ford MRCT Add Wong

54 References [1] B. Wu and K. Chao, Spanning Trees and Optimization Problems, Chapman & Hall, 2004. [2] R. Diestel, Graph Theory, Springer-Verlag Heidelberg, New York, Electronic Edition 2005. [3] V. Grout, Principles of Cost Minimization in Wireless Networks, J. of Heuristics 11 (2005) 115- 133.

55 Contact Rui Campos (+351) 222 094 268 rcampos@inescporto.pt http://telecom.inescporto.pt/~rcampos


Download ppt "Spanning Trees in Communication Networks Rui Campos INESC Porto, Faculdade de Engenharia, Universidade do Porto"

Similar presentations


Ads by Google