Download presentation
Presentation is loading. Please wait.
1
Graph Theory in Networks
Lecture 2, 9/2/04 EE 228A, Fall 2004 Rajarshi Gupta University of California, Berkeley
2
Plan for Graph Segment Lecture 2 – Thu (Sep 2, 2004)
Paths and Routing Cycles and Protection Matching and Switching Lecture 3 – Tue (Sep 7, 2004) Coloring and Capacity Trees and Broadcast, Multicast Lecture 4 – Thu (Sep 9, 2004) Complete example: Capacity in Ad-Hoc Networks Lectures 8 & 9 – (Sep 23 & 28, 2004) Student Presentations (have you signed up ?) Lecture 2, 9/2/04
3
Network looks like Graph !
Lecture 2, 9/2/04
4
Using Graph Theory in Networking
Modeling Appropriate underlying graph Captures required behavior Warning: slight difference entirely changes results Analysis Proofs/results from relevant graph theoretic technique Reality Check Does in make sense ? Perhaps ignored some important feature Lecture 2, 9/2/04
5
Routing: Dijkstra Given a graph G = (V, E) Applications
Dijkstra, E.W., “A Note on Two Problems in Connexion with Graphs,” Numerische Mathematik, vol. 1, pp , 1959. Given a graph G = (V, E) Finds weighted shortest path from a single source to all other nodes Works with non-negative edge weights Applications OSPF routing (edge weight = 1) Mapquest (edge weight = traversal time) Many, many, many more … Lecture 2, 9/2/04
6
Dijkstra Review Initialize while end while Lecture 2, 9/2/04
7
Proof of Correctness Need to show that this is correct !
Thm: Label v(i) is the shortest path cost to i Lemma: Labels in P are the shortest path involving nodes in P. Then when P = V, the theorem holds Proof of Lemma Suppose we have a shorter path using node in T Let be two nodes in path, with in between But if Then we would have picked t before q (Contradicton) Lecture 2, 9/2/04
8
Principle of Optimality
Partial paths of SP are also shortest Proof: Let P={s,…,p,…i,…q,…d} be the SP from s to d Suppose {p,…i,…q} as above is not SP from p to q i.e. Cost {p,…i,…q} > Cost {p,…j,…q} Then, P’={s,…,p,…j,…q,…d} has lesser cost than P So P is not the SP (contradiction) Allows computing partial path and extending hop by hop Lecture 2, 9/2/04
9
General Principle of Optimality
In general, hope that partial paths of “optimal” paths are also optimal. E.g. Minimum Delay Paths Widest path If true, amenable to distributed algorithms If not, often NP-hard E.g. Shortest Widest Path Both types of cases found in networking Will cover in Lecture 4 Lecture 2, 9/2/04
10
Optimality Counter-example
Lecture 2, 9/2/04
11
Dijkstra Complexity Initialize while end while Lecture 2, 9/2/04
12
Dijkstra Complexity (contd)
True metric of algorithm usefulness n = # of nodes, m = # of edges Dijkstra Main loop runs n times Finding min takes O(n) Then, updating values is O(m) So, total algo is O(n2+m) Can improve loop+min (using binary heap) to give O(nlogn+m) Lecture 2, 9/2/04
13
Other Routing Algorithms
Bellman Ford single source shortest path, negative wts O(mn) Floyd Warshall all pairs shortest path O(n3) Johnson O(n(m+nlogn)) obvious for +ve edge weights All-pairs shortest path reqd to set up routing tables Lecture 2, 9/2/04
14
Directed Acyclic Graph (DAG)
Generalization of the tree concept to directed graphs Special Features Cannot have cycles Always exists one node with in-degree 0 (Quick Proof) Allows topological ordering of nodes Applications Tournaments, Games Scheduling problems Lecture 2, 9/2/04
15
SP in DAG Due to lack of cycles, topological ordering of nodes (check up) Can be done in O(m) Correctness Since no cycles, we have checked every possible path over the for loop Algorithm Initialize for j = (s+1) to n next j Complexity We only check each edge once, so O(m) Lecture 2, 9/2/04
16
Protection Paths In many situations, we need two paths
Normal Path Protection Path Types of protection Path Protection Span Protection Link Protection Type of protection paths Node disjoint Link Disjoint Lecture 2, 9/2/04
17
Min Cost Protection Paths
Common Algorithm Find Shortest Path Make G’ = (V, E\) Find shortest path ’ in G’ Advantages Computationally simple Two Dijkstra/BF Shortest Normal Path, which is used much Backup path used rarely Problems Cost (+’) may not be optimal may block off all possible ’ Lecture 2, 9/2/04
18
P-Cycle Lecture 2, 9/2/04
19
P-Cycle (contd) P-Cycle Algorithm
Want to find set of elementary cycles Minimizes total capacity on these cycles All working links must be protected Integer programming solution Followup: Given two nodes i,j, find min cost cycle in G that covers i and j Lecture 2, 9/2/04
20
What are you Protecting ?
IP Layer When modeling with a graph, remember Present structure Underlying behavior In this case, unclear Edge costs are IP layer costs Protection guarantee is lower layer phenomenon Perhaps need a different graph model Optical Layer Normal Path Protection Path Lecture 2, 9/2/04
21
Matching M E s.t no two edges in M share a common end node
A maximum cardinality matching is matching with a maximum number of edges Max/min weighted matching chooses edges with max weight Of special interest are matchings in Bi-Partite Graphs Lecture 2, 9/2/04
22
Matching in Bi-Partite Graph
Stable Marriage Look at M men and N women, with partner preferences For any pair Alice & Bob, one of following is true Alice & Bob are married Alice prefers her partner to Bob Bob prefers his partner to Alice No pair (A,B) and (C,D) such that (A,D) and (B,C) would both be preferred :-) Switching ! N ports (input & output) Effectively, N input and N output ports Packets (w priority) are queued on input port Each port ‘ranks’ its preferrence for output ports based on priority Want optimal input-output match Lecture 2, 9/2/04
23
Stable Marriage Problem
Stable Marriage always exists, for any preferences Girl-oriented Algorithm Girls successively make proposals to boys (engaged or not) If a girl proposes to a boy who is free (not yet paired), the boy ‘accepts’ the proposal. If the girl proposes to a boy who is already paired If this proposal is a better proposal from the boy’s perspective, then the boy breaks the old proposal and accepts the new one. If the proposal is not a better one, the boy rejects the proposal. Key of Proof Consider arbitrary g. If g prefers b’ to b, then b’ must have rejected g and been paired with some g’ whom he prefers to g. As choice of g is arbitrary, there are no unstable pairs. Algorithm completes within N2 iterations and is ‘girl-optimal’. Lecture 2, 9/2/04
24
Vertex Cover Definition Observe: Application
Set of nodes NC of G such that every edge of G has at least one node in NC Observe: ‘Opposite’ of Matching Max cardinality of matching is at most the min cardinality of node cover Equal in a bi-partite graph Application Choose a min set of nodes in an ad-hoc network to exercise control over all the links Lecture 2, 9/2/04
25
Min Cost Cycle Cover Problem: Cover all nodes with disjoint cycles
Want least total cost of these cycles Formulate G’ Replicate V into U, W Join ui to wj if (vi,vj)E cost(ui,wj) = cost(vi,vj) Observe G’ is bipartite Cycle Cover in G is perfect matching in G’ Therefore Evaluate min cost perfect matching in G’ Polynomial time (bi-partite) Lecture 2, 9/2/04
26
Euler’s Formula For any convex polyhedron, V-E+F=2 Examples
V = Vertices E = Edges F = Faces Examples Tetrahedron: V=4, E=6, F=4 Cube: V=8, E=12, F=6 Octahedron: V=6, E=12, F=8 Dodecahedron: V=20, E=30, F=12 Icosahedron: V=12, E=30, F=20 BuckyBall: V=60, E=90, F=32 Lecture 2, 9/2/04
27
Proof of Euler’s Formula
Proof by induction If no edges, its an isolated vertex. So V=1, E=0, F=1 Else choose any edge If it connects two vertices, contract it. This reduces V by 1 and E by 1 Else the edge must separate two faces (Jordan curve). Remove it. Reduces F by 1 and E by 1. Lecture 2, 9/2/04
28
Lessons from Today’s Lecture
Path algorithms useful for routing Prove correctness Principle of Optimality allows distributedness Matching useful in Switching etc Key Analyses Correctness Optimality Complexity Lecture 2, 9/2/04
29
Papers to read Coloring (one of the two) Routing Matching
H. Luo, S, Lu, and V. Bhargavan, “A New Model for Packet Scheduling in Multihop Wireless Networks,” Proceedings ACM Mobicom 2000, pp M. Kodialam, and T. Nandagopal, “Characterizing the Achievable Rates in Multihop Wireless Networks,” Proceedings ACM Mobicom 2003, San Diego, CA, September 2003. Routing M. Kodialam and T. Lakshman, “Minimum Interference Routing with Applications to MPLS Traffic Engineering,” Proceedings IEEE INFOCOM 2000. S. Deering and D. Cheriton, "Multicast Routing in Internetworks and Extended LANs", SIGCOMM'88, Stanford, CA, Aug 1988, Matching Nick McKeown and Thomas E. Anderson, "A Quantitative Comparison of Scheduling Algorithms for Input-Queued Switches", Computer Networks and ISDN Systems, Vol 30, No 24, pp , December 1998. Lecture 2, 9/2/04
30
References Graph Theory, by Frank Harary
Integer and Combinatorial Optimization, by G.L. Nemhauser and L.A. Wolsey Network Flows: Theory, Algorithms and Applications by Ravindra K. Ahuja, Thomas L. Magnanti and James B. Orlin Lecture 2, 9/2/04
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.