M/CS 6 Clss 1: Grph Recp By Adm Sheffer Course Detils Adm Sheffer. Office hour: Tuesdys 4pm. dmsh@cltech.edu TA: Victor Kstkin. Office hour: Tuesdys 7pm. 1:00 Mondy, Wednesdy, nd Fridy. http://www.mth.cltech.edu/~2014-15/2term/m006/ 1
Course Structure No exm! Grde sed on weekly homework ssignments. Due y noon on Wednesdys. Plese red the homework policy on the wesite! Books Introduction to Grph Theory, 2 nd edition, Dougls West. Grph Theory, 4th edition, Reinhrd Diestel. Grphs Undirected grph Directed grph Edge Vertex In this clss, unless stted otherwise, the grph is undirected. 2
Grph Representtion We write G = V, E. Tht is, the grph G hs vertex set V nd edge set E. Exmple. In the figure: V =,, c, d, e. E = *,,, d,, e,, c,, e +. c d e Grph Representtion (cont.) V =,, c, d, e. E = *,,, d,, e,, c,, e +. c c d e d e 3
Simple Grphs An edge is loop if oth of its endpoints re the sme vertex. Two edges re prllel if they re etween the sme pir of vertices. A grph is simple if it contins no loops nd no prllel edges. Unless stted otherwise, the grph is simple. A loop Prllel edges Degrees The degree of vertex is the numer of edges tht re djcent to it. Prove. In ny grph, the sum of the degrees of the vertices is even. Proof. Every edge contriutes 1 to the degree of exctly two vertices. Thus, v V deg v = 2 = 2 E. e E 4
Sugrphs nd Averge Degree Given two grphs G = (V, E) nd G = V, E. We sy tht G is sugrph of G if V V nd E E. We sy tht G is n induced sugrph on V V if E contins exctly the edges of E tht connect two vertices of V. The verge degree of grph G = V, E is deg G = 1 deg v = 2 E V V. v V Induced Sugrphs Which of these is n induced sugrph? c d c d c d c 5
Sugrphs with Lrge Degrees Prolem. For every grph G = V, E with E 1 there exists n induced sugrph H of G, such tht the minimum degree in H is lrger thn deg G /2. E V = 7 6 Solution Set k = deg G /2 = E / V. We repetedly remove vertices of degree t most k until none re left. If no vertex of G hs degree k, we re done. Otherwise, how cn we mke sure tht we do not remove the entire grph? Denote our sequence of sugrphs s G = G 0, G 1, G 2,, G m. At ech step, we remove one vertex nd t most k edges. We thus hve deg G m deg G m 1 deg G 1 2k. 6
Solution (cont.) Denote our sequence of sugrphs s G = G 0, G 1, G 2,, G m. At ech step, we remove one vertex nd t most k edges. We thus hve deg G m deg G m 1 deg G 1 > 2k. Since deg G m 2k, it must contin edges. Pths nd Cycles Pth etween nd. Cycle through A cycle is pth tht strts nd ends in the sme vertex. 7
More on Pths nd Cycles A pth/cycle is sid to e simple if it does not visit ny vertex more thn once. The length of pth/cycle is the numer of edges tht it consists of. Exmple. A simple cycle of length 5. Connected Grphs A grph G = (V, E) is connected if for ny pir u, v V, there is pth in G etween u nd v. 8
Connected Components A connected component (for short, component) of grph G = V, E is mximl connected sugrph of G. For exmple, grph with three connected components: Pths nd Degrees Prolem. Let G = V, E e grph such tht the degree of every v V is t lest d (for some d 2). Prove tht G contins pth of length d. A grph with minimum degree 3. 9
Proof Assume, for contrdiction, tht longest pth P is of length c < d. Consider vertex v which is n endpoint of P. Since deg v d c + 1, it must e connected to t lest one vertex u P. By dding the edge v, u to P, we otin longer pth, contrdicting the mximlity of P. v A Vrint of the Prolem Prolem. Let G = V, E e grph such tht the degree of every v V is t lest d (for some d 2). Then there exists cycle of length t lest d + 1 10
Distnce Consider n undirected grph G = (V, E) nd two vertices v, u V. The distnce in G etween u nd v, denoted d u, v is the length of the shortest pth etween the two vertices. The dimeter of G is the mximum distnce etween two vertices of G Tht is, mx d u, v. u,v Dimeter nd Cycles Prove. Let G = V, E e grph of dimeter D tht contins t lest one cycle. Then G contins cycle of length t most 2D + 1. Exmple. Dimeter: 2 Length of shortest cycle: 5 11
Proof Assume, for contrdiction, tht the length of the shortest cycle C is t lest 2D + 2. Consider two vertices u, v with distnce of D + 1 in C. If there is no shorter pth etween u nd v, we get contrdiction to the dimeter eing D. If there is shorter pth etween u nd v, we get contrdiction for C eing the shortest cycle in G. More Degrees nd Distnces Prolem. Consider n grph G = V, E nd integers k, d 3, such tht The degree of every vertex of V is t most d. There exists vertex v V such tht for every u V we hve d u, v k. Wht is the mximum numer of vertices tht V cn contin? 12
Solution We prtition the vertices of V ccording to their distnce from v: How mny vertices stisfy d v, u = 0? 1 How mny vertices stisfy d v, u = 1? At most d. How mny vertices stisfy d v, u = 2? At most d(d 1). How mny vertices stisfy d v, u = i? At most d d 1 i 1, for every 1 i k. Solution (cont.) We hve the ound V 1 + d + d d 1 + + d d 1 k 1 = 1 + d d 1 k 1 d 1 1 = d d 1 k 2. d 2 Is this tight? Yes 13
Trees nd Forests In grph, tree is connected sugrph contining no cycles. A forest is set of non-connected trees. A forest with four trees Leves Given tree T, lef of T is vertex of degree 1. Clim. Every tree contins lef. Proof. Consider vertex v in T. If v hs degree 1, we re done. Otherwise, we trvel the tree without crossing ny edge more thn once. No vertex is visited twice since there re no cycles in T. Thus, eventully we will get stuck. The vertex tht we got stuck in is of degree 1. 14
The Size of Tree Given tree with n vertices, how mny edges re in it? Exctly n 1. Proof sketch. By induction. By removing lef we otin tree y one vertex nd one edge. Unique Pths in Trees Clim. In ny tree T there is exctly one pth etween ny two vertices. Assume, for contrdiction, tht there re two pths P, Q in T etween vertices s nd t. u the lst common vertex efore the pths P, Q split (when trveling from s to t). v the first vertex common to oth pths fter u. The portions of P nd Q s u v t etween u nd v form cycle. Contrdiction! 15
Rooted Trees A rooted tree is tree with specil vertex the root tht is singled out. We drw the tree with the root on top, nd the edges grow downwrds. A vertex v is the prent of vertex u if there is n edge u, v nd v is ove u. Ech vertex, except for the root, hs unique prent. s t s is the root nd t s prent The BFS Algorithm s c d e The BFS lgorithm receives grph G = V, E nd vertx s V. It outputs BFS tree, contining shortest pths from s to ny vertex rechle from s. A rooted tree with root s. c d s e 16
Levels of the BFS Tree The i th level of the BFS tree is the set of vertices v V tht stisfy d v = i. s c f e d f s c e Level 0 Level 1 Level 2 d Level 3 * This is the origin of the nme Bredth First Serch. The End 17