Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graph Theory in Networks Lecture 3, 9/7/04 EE 228A, Fall 2004 Rajarshi Gupta University of California, Berkeley.

Similar presentations


Presentation on theme: "Graph Theory in Networks Lecture 3, 9/7/04 EE 228A, Fall 2004 Rajarshi Gupta University of California, Berkeley."— Presentation transcript:

1 Graph Theory in Networks Lecture 3, 9/7/04 EE 228A, Fall 2004 Rajarshi Gupta University of California, Berkeley

2 Rajarshi Gupta 2 Lecture 3, 9/7/04 EE 228A, Fall 2004 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 ?)

3 Rajarshi Gupta 3 Lecture 3, 9/7/04 EE 228A, Fall 2004 Coloring: History Map coloring: Color all countries on a map using fewest colors Model: Each country is a node, edge if share boundary This forms a planar graph (edges don’t intersect)

4 Rajarshi Gupta 4 Lecture 3, 9/7/04 EE 228A, Fall 2004 4 & 5 Color Theorems Five color theorem: Every planar graph is 5-colorable Heawood, 1890 Four Color Theorem: Every planar graph is 4-colorable Conjectured for many years (since 1890) Proved by Appel and Haken (1977) Can do no better than 4 colors K 4 (complete graph in 4 vertices) is planar

5 Rajarshi Gupta 5 Lecture 3, 9/7/04 EE 228A, Fall 2004 5 Color Theorem (Lemma) Lemma: In a planar graph,  node w deg  5 Recall Euler’s Formula v- e+f=2 A planar graph with outside face = polyhedron Let d be avg node deg. So dv=2e r be avg face deg. So rf=2e Rewrite Euler But r  3, So Replacing e=dv/2, Hence For a finite graph, there must exist some node with degree < 6 f1f2 f3 f4v=4 e=6 f=4

6 Rajarshi Gupta 6 Lecture 3, 9/7/04 EE 228A, Fall 2004 5 Color Theorem Proof Induction: If v<6, trivial Assume true for v-1 vertices In G, remove node v with deg<6 Color rest of graph with 5 colors Can do this due to induction hypothesis Consider v Look at the 5 nodes around it If use < 4 colors, we are done

7 Rajarshi Gupta 7 Lecture 3, 9/7/04 EE 228A, Fall 2004 5 Color Theorem Proof (contd) Else look at induced subgraph only with colors red and blue If v1 and v3 not connected, interchange colors of v1- component s.t v1 is colored blue. And give red color to v. Else: v1-v-v2-v1 topologically separates v2 from v4 Now repeat the procedure for v2 and v4 There cannot be path from v2 to v4 (with colors green and pink) since graph is planar Hence can change color of v2

8 Rajarshi Gupta 8 Lecture 3, 9/7/04 EE 228A, Fall 2004 Chromatic Number Chromatic number Fewest number of colors required to color a graph Few common graphs K n is n-colorable Bipartite graphs are 2-colorable Planar graphs are 4-colorable

9 Rajarshi Gupta 9 Lecture 3, 9/7/04 EE 228A, Fall 2004 Theorem: Graph bi-colorable iff no odd cycles ‘  ’ Direction Proof by contradiction Assume odd cycle exists Color nodes on odd cycle as R, B, R, B … Eventually last node will have two neighbors with opposite colors ‘  ’ Direction Take any point v Make two sets V 1 and V 2 V 1 = nodes odd dist from v V 2 = nodes even dist frm v Claim: Every edge joins V 1 to V 2 Suppose line xy joins two nodes in same set Then cycle {v…x}+{xy}+{y…v} is odd {v…x} and {y…v} are both odd or both even By claim, color V 1 red and V 2 blue

10 Rajarshi Gupta 10 Lecture 3, 9/7/04 EE 228A, Fall 2004 Independent Sets (IS) Set of nodes that do not have an edge between them Set of nodes that can have the same color Maximal IS: not contained in any other IS Result: Number of maximal IS in a graph is exponential Graph coloring algorithms find IS Finding the chromatic number of a graph is NP-hard Many approximations exist

11 Rajarshi Gupta 11 Lecture 3, 9/7/04 EE 228A, Fall 2004 Approximate Coloring Greedy Algorithm Order nodes by degree Add first node to IS Discard all neighbors into a Future bin Repeat till set empty Start with future bin Correctness Are the sets generated independent ? Are they maximal ? Complexity Each iteration adds one node, so O(m) Discarding neighbors O(n) Total: O(mn) Followup: How far is this from optimal coloring Arbitrary or Bounded Many approx algos give coloring within 4X, 6X of optimal

12 Rajarshi Gupta 12 Lecture 3, 9/7/04 EE 228A, Fall 2004 Cliques Observe Each node in a clique needs a different color So    Clique is complement of IS Maximal Cliques: ABC, BCEF, CDF Definitions Clique = Complete Subgraph Maximal Clique = Clique not a subset of any other Clique Number  = size of largest clique  = 4

13 Rajarshi Gupta 13 Lecture 3, 9/7/04 EE 228A, Fall 2004 Perfect Graphs A graph is said to be perfect when its Chromatic Number  Clique Number  Are equal For all induced subgraphs Strong Perfect Graph Theorem Chudnovsky, Robertson, Seymour, Thomas (2002) A graph is perfect if and only if it has no odd holes or odd anti-holes Odd-hole is a odd cycle with no chord Odd anti-hole is complement of odd-hole

14 Rajarshi Gupta 14 Lecture 3, 9/7/04 EE 228A, Fall 2004 Duplication Lemma Lovasz (1972) Take a vertex v in G Add v’ s.t. v’ is neighbor to every neighbor of v If G is perfect, then G’ is perfect Proof Consider induced subgraph H’ of G’ If v’  H’, then  (H’)=  (H’) If v’  H’ but v  H’, then H’ isomorphic to corres. H If v,v’  H’ Consider H=H’\{v’} Since v and v’ are not connected, can give color of v to v’ (same neighbors) So  (H’)=  (H) Also  (H’)=  (H) Clique w/o v is not enlarged Clique with v is not enlarged as v and v’ not connected But  (H)=  (H) as G perfect Hence  (H’)=  (H’) and G’ is also perfect

15 Rajarshi Gupta 15 Lecture 3, 9/7/04 EE 228A, Fall 2004 Trees Define a tree G=(V,E) |V| = |E| + 1 Terminology Height of a tree Depth of a node In-degree Out-degree Leaves

16 Rajarshi Gupta 16 Lecture 3, 9/7/04 EE 228A, Fall 2004 Useful Trees Types of Trees Binary Tree Each non-leaf node has exactly 2 children Ternary Tree Height Balanced Tree Root chosen s.t. height is minimized Bipartite Graphs Induced Trees Formed by choosing a subset of V,E from G Rooted Tree Rooted at particular node Spanning Tree Covers every node ‘Subset Spanning Tree’ Covers every node in a chosen subset

17 Rajarshi Gupta 17 Lecture 3, 9/7/04 EE 228A, Fall 2004 Trees in Networks Broadcast Tree Search Trees BFS DFS Spanning Tree Protocol (STP) in Bridged Networks (e.g. Ethernet) Multicast Tree And many, many other places …

18 Rajarshi Gupta 18 Lecture 3, 9/7/04 EE 228A, Fall 2004 Trees and Ethernet Tree Feature Connected No cycles Removing any edge makes it disconnected Adding any edge forms a cycle Every pair of nodes has unique path Ethernet Behavior Need all LANs to talk Loops cause broadcast storms Any bridge/port failure needs recomputation Need to disable all redundant ports Guarantees path with STP

19 Rajarshi Gupta 19 Lecture 3, 9/7/04 EE 228A, Fall 2004 Concrete Example Weight balanced Spanning Tree (WBST) Each edge has cost e.g. 10/100/1000 Mbps Choose spanning tree that has min difference between min and max edge cost Want to minimize buffering requirements as packets move through the network. Also control jitter. Complexity

20 Rajarshi Gupta 20 Lecture 3, 9/7/04 EE 228A, Fall 2004 Recall Spanning Tree Algos Kruskal’s Greedy Algorithm to compute Spanning Tree 1. Order the edges in term of weight 2. Add lowest cost edge (provided no loops) 3. Check if all vertices is connected 4. If not, return to step 2 Any search (BFS/DFS) can check for connectedness BFS/DFS may be performed in O(m)

21 Rajarshi Gupta 21 Lecture 3, 9/7/04 EE 228A, Fall 2004 WBST : Algorithm Sort edges in increasing order of weight c 1 <c 2 <…<c m Initialize: diff = c m -c 1, low = 1, high = 1 Take G low,high = G (V, {c i : low  i  high}) if G low,high is connected if diff > (c high – c low ) diff := c high – c low Remember low, high low := low + 1 repeat else high := high + 1 repeat

22 Rajarshi Gupta 22 Lecture 3, 9/7/04 EE 228A, Fall 2004 WBST : Correctness Spanning Tree exists By checking G low,high is connected => spanning tree must exist Do this using DFS. Also finds the WBST Why balanced Keep adding low cost edges till graph connected Then try to discard as many low cost edges Move both ‘low’ and ‘high’ pointers to consider other ranges Remember best diff

23 Rajarshi Gupta 23 Lecture 3, 9/7/04 EE 228A, Fall 2004 WBST : Complexity In each iteration, we either increment low, or increment high So max number of iterations = 2m Each iteration needs to check connectedness: DFS O(m) So entire algo is O(m 2 ) Think: How would we make this algorithm distributed

24 Rajarshi Gupta 24 Lecture 3, 9/7/04 EE 228A, Fall 2004 Multicast Trees Application: Want to send packets from a source (e.g. internet radio station) to many hosts Sending n copies of the stream is wasteful Solution: Form tree rooted at source that spans all member nodes

25 Rajarshi Gupta 25 Lecture 3, 9/7/04 EE 228A, Fall 2004 Distributed Algorithm Need to know address of group First Join First member sends route request Request will be forwarded all the way to source Confirmation flows back to member All routers in path will add entry (mc_addr | port) Subsequent Join New member send route request Request forwarded to router that has mc_addr entry Send confirmation from this point on Augment route entry (mc_addr | port1, port2) Think: Optimal multicast tree

26 Rajarshi Gupta 26 Lecture 3, 9/7/04 EE 228A, Fall 2004 Multicast Algorithm (contd) Leave/Pruning Node leaving sends leave message to router Router removes port from route entry If last port entry deleted, send prune message to parent Multi-source multicast tree Less optimal: packets between two branches travel long distance But need to minimize state in routers

27 Rajarshi Gupta 27 Lecture 3, 9/7/04 EE 228A, Fall 2004 Lessons from this lecture Coloring Cliques Independent Sets Useful in capacity, scheduling Trees Bridged Networks Multicasting Used often when want to ensure unique path etc

28 Rajarshi Gupta 28 Lecture 3, 9/7/04 EE 228A, Fall 2004 Words of Wisdom (1) Graph Theory is an old field Konigsberg Bridge problem: Euler 1736 Lots of famous people 18 th and 19 th Century: Euler, Hamilton, Gauss 20 th Century: Erdos, Lovasz, Harary It is a very deep field. Takes years to get to cutting edge Replete in terminology – names for everything ! hole, cut, tree, forest, cycle, walk, degree, girth, face, cover, heredity, clique, independence, animal

29 Rajarshi Gupta 29 Lecture 3, 9/7/04 EE 228A, Fall 2004 Words of Wisdom (2) Searching for results in Graph Theory is tricky E.g. “Clique Algorithms” yielded nice list of referrences … 150 pages long !!! Need to have some understanding of Graph Theory to be able to utilize its results Take IEOR 266: Network Flows and Graphs


Download ppt "Graph Theory in Networks Lecture 3, 9/7/04 EE 228A, Fall 2004 Rajarshi Gupta University of California, Berkeley."

Similar presentations


Ads by Google