Grph Theory Simple Grph G = (V, E). V ={verties}, E={eges}. h k g f e V={,,,,e,f,g,h,k} E={(,),(,g),(,h),(,k),(,),(,k),...,(h,k)} E =16. 1
Grph or Multi-Grph We llow loops n multiple eges. G = (V, E.ψ) g replements e 1 e2 e 4 e 3 e 5 e 7 e 8 e e 6 V = {,,,, e}, E = {e 1, e 2,..., e 8 }. t 1 2 3 4 5 6 7 8 ψ(t) e e e e 2
Eulerin Grphs Cn you rw the igrm elow without tking your pen off the pper or going over the sme line twie? 3
Biprtite Grphs G is iprtite if V = X Y where X n Y re isjoint n every ege is of the form (x, y) where x X n y Y. In the igrm elow, A,B,C,D re women n,,, re men. T here is n ege joining x n y iff x n y like eh other. The re eges form perfet mthing enling everyoy to e pire with someone they like. Not ll grphs will hve perfet mthing! A B C D 4
Vertex Colouring R B R G B R Colours {R,B,G} B Let C = {olours}. A vertex olouring of G is mp f : V C. We sy tht v V gets oloure with f(v). The olouring is proper iff (, ) E f() f(). The Chromti Numer χ(g) is the minimum numer of olours in proper olouring. Applition: V ={exms}. (, ) is n ege iff there is some stuent who nees to tke oth exms. χ(g) is the minimum numer of perios require in orer tht no stuent is sheule to tke two exms t one. 5
Sugrphs G = (V, E ) is sugrph of G = (V, E) if V V n E E. G is spnning sugrph if V = V. f e g h e f g NOT SPANNING h SPANNING 6
If V V then G[V ] = (V, {(u, v) E : u, v V }) is the sugrph of G inue y V. e G[{,,,,e}] 7
Similrly, if E 1 E then G[E 1 ] = (V 1, E 1 ) where V 1 = {v V 1 : e E 1 suh tht v e} is lso inue (y E 1 ). E 1 = {(,), (,)} g replements G[ ] E 1 8
Isomorphism for Simple Grphs G 1 = (V 1, E 1 ) n G 2 = (V 2, E 2 ) re isomorphi if there exists ijetion f : V 1 V 2 suh tht (v, w) E 1 (f(v), f(w)) E 2. A B D f()=a et. Isomorphism for Grphs C G 1 = (V 1, E 1, ψ 1 ) n G 2 = (V 2, E 2, ψ 2 ) re isomorphi if there exist ijetions f : V 1 V 2 n g : E 1 E 2 suh tht ψ 1 (e) = ψ 2 (g(e)) = f()f(). 9
Complete Grphs K n = ([n], {(i, j) : 1 i < j n}) is the omplete grph on n verties. K m,n = ([m] [n], {(i, j) : i [m], j [n]}) is the omplete iprtite grph on m + n verties. (The nottion is little impreise ut hopefully ler.) K 5 frg replements K 2,3 10
Vertex Degrees ements f G (v) = egree of vertex v in G = numer of eges inient with v δ(g) = min G (v) v (G) = mx v g e G (v) G G () = 2, G (g) = 4 et. δ(g) = 2, (G) = 4 If V = {1, 2,..., n} then = 1, 2,..., n where j = G (j) is lle the egree sequene of G. 11
Mtries n Grphs Iniene mtrix M: V E mtrix. M(v, e) = { 1 v e 0 v / e e 1 e 2 e 3 e 4 e 5 e 6 e 7 e 8 1 1 1 1 1 1 1 1 1 PSfrg replements 1 1 1 e 1 1 1 1 e 2 e 1 e 5 e e 6 e 7 e 8 e 3 e 4 12
Ajeny mtrix A: V V mtrix. A(v, w) = numer of v, w eges. PSfrg replements e 1 1 1 1 1 1 1 1 1 1 1 1 e 1 1 1 1 e 2 e 1 e 5 e e 6 e 7 e 8 e 3 e 4 13
Theorem 1 v V G (v) = 2 E Proof Consier the iniene mtrix M. Row v hs G (v) 1 s. So # 1 s in mtrix M is G (v). v V Column e hs two 1 s. So # 1 s in mtrix M is 2 E. 14
Corollry 1 In ny grph, the numer of verties of o egree, is even. Proof Let ODD = {o egree verties} n EV EN = V \ ODD. is even. v ODD (v) = 2 E v EV EN (v) So ODD is even. 15
Pths n Wlks W = (v 1, v 2,..., v k ) is wlk in G if (v i, v i+1 ) E for 1 i < k. A pth is wlk in whih the verties re istint. W 1 is pth, ut W 2, W 3 re not. e frg replements W 1 W 2 W 3 =,,,e, 2 =,,,,e =g,f,,e,f g f 16
A wlk is lose if v 1 = v k. A yle is lose wlk in whih the verties re istint exept for v 1, v k.,, e,, is yle.,,,,, e,, is not yle. e g f 17
Connete omponents We efine reltion on V. iff there is wlk from to. e g f ut. Clim: is n equivlene reltion. Reflexivity v v s v is (trivil) wlk from v to v. Symmetry u v implies v u. (u = u 1, u 2..., u k = v) is wlk from u to v implies (u k, u k 1,..., u 1 ) is wlk from v to u. 18
Trnsitivity u v n v w implies u w. W 1 = (u = u 1, u 2..., u k = v) is wlk from u to v n W 2 = (v 1 = v, v 2, v 3,..., v l = w) is wlk from v to w imples tht (W 1, W 2 ) = (u 1, u 2..., u k, v 2, v 3,..., v l ) is wlk from u to w. The equivlene lsses of re lle onnete omponents. In generl V = C 1 V 2 C r where C 1, C 2,..., C r re the onnete omonents. We let ω(g)(= r) e the numer of omponents of G. G is onnete iff ω(g) = 1 i.e. there is wlk etween every pir of verties. Thus C 1, C 2,..., C r inue onnete sugrphs G[C 1 ],..., G[C r ] of G 19
Pths n wlks For wlk W we let l(w ) = no. of eges in W. replements l(w ) = 6 Lemm 1 Suppose W is wlk from vertex to vertex n tht W minimises l over ll wlks from to. Then W is pth. Proof Suppose W = ( = 0, 1,..., k = ) n i = j where 0 i < j k. Then W = ( 0, 1,..., i, j+1,..., k ) is lso wlk from to n l(w ) = l(w ) (j i) < l(w ) ontrition. Corollry 2 If then there is pth from to. So G is onnete, V there is pth from to. 20
Wlks n powers of mtries Theorem 2 A k (v, w) = numer of wlks of length k from v to w with k eges. Proof By inution on k. Trivilly true for k = 1. Assume true for some k 1. Let N t (v, w) e the numer of wlks from v to w with t eges. Let N t (v, w; u) e the numer of wlks from v to w with t eges whose penultimte vertex is u. u v w 21
N k+1 (v, w) = N k+1 (v, w; u) u V = u V = u V N k (v, u)a(u, w) A k (v, u)a(u, w) = A k+1 (v, w). inution 22
Breth First Serh BFS Fix v V. For w V let (v, w) = minimum numer of eges in pth from v to w. For t = 0, 1, 2,..., let A t = {w V : (v, w) = t}. A 1 A 2 A 3 A 4 ements v A 2 A 3 A 4 A 4 A 1 A 2 A 3 A 0 = {v} n v w (v, w) <. 23
In BFS we onstrut A 0, A 1, A 2,..., y A t+1 = {w / A 0 A 1 A t : n ege (u, w) suh tht u A t }. Note : no eges (, ) etween A k n A l for l k 2, else w A k+1 A l. (1) In this wy we n fin ll verties in the sme omponent C s v. By repeting for v / C we fin nother omponent et. 24
Chrteristion of iprtite grphs Theorem 3 G is iprtite G hs no yles of o length. Proof : G = (X Y, E). Y X X Y Typil Cyle Y X Suppose C = (u 1, u 2,..., u k, u 1 ) is yle. Suppose u 1 X. Then u 2 Y, u 3 X,..., u k Y implies k is even. Assume G is onnete, else pply following rgument to eh omponent. Choose v V n onstrut A 0, A 1, A 2,..., y BFS. X = A 0 A 2 A 4 n Y = A 1 A 3 A 5 25
We nee only show tht X n Y ontin no eges n then ll eges must join X n Y. Suppose X ontins ege (, ) where A k n A l. (i) If k l then k l 2 whih ontrits (1) (ii) k = l: plements v v j There exist pths (v = v 0, v 1, v 2,..., v k = ) n (v = w 0, w 1, w 2,..., w k = ). Let j = mx{t : v t = w t }. (v j, v j+1,..., v k, w k, w k 1,..., w j ) is n o yle length 2(k j) + 1 ontrition. 26