graph theory graph g v e v vertices e edges
play

Graph Theory Graph G = ( V , E ) . V ={vertices}, E ={edges}. a b - PowerPoint PPT Presentation

Graph Theory Graph G = ( V , E ) . V ={vertices}, E ={edges}. a b c h d k g e f V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)} |E|=16. Digraph D = ( V , A ) . V ={vertices}, E ={edges}. a b c h d k


  1. Graph Theory

  2. Graph G = ( V , E ) . V ={vertices}, E ={edges}. a b c h d k g e f V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)} |E|=16.

  3. Digraph D = ( V , A ) . V ={vertices}, E ={edges}. a b c h d k g e f V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( h,a),(k,a),(b,c),(k,b),...,(h,k)} |E|=16.

  4. Eulerian Graphs Can you draw the diagram below without taking your pen off the paper or going over the same line twice?

  5. Bipartite Graphs G is bipartite if V = X ∪ Y where X and Y are disjoint and every edge is of the form ( x , y ) where x ∈ X and y ∈ Y . In the diagram below, A,B,C,D are women and a,b,c,d are men. There is an edge joining x and y iff x and y like each other. The thick edges form a “perfect matching” enabling everybody to be paired with someone they like. Not all graphs will have perfect matching! A a b B c C D d

  6. Vertex Colouring R Colours {R,B,G} B B G R R B Let C = { colours } . A vertex colouring of G is a map f : V → C . We say that v ∈ V gets coloured with f ( v ) . The colouring is proper iff ( a , b ) ∈ E ⇒ f ( a ) � = f ( b ) . The Chromatic Number χ ( G ) is the minimum number of colours in a proper colouring.

  7. Subgraphs G ′ = ( V ′ , E ′ ) is a subgraph of G = ( V , E ) if V ′ ⊆ V and E ′ ⊆ E . G ′ is a spanning subgraph if V ′ = V . a f d e b g c h a a

  8. If V ′ ⊆ V then G [ V ′ ] = ( V ′ , { ( u , v ) ∈ E : u , v ∈ V ′ } ) is the subgraph of G induced by V ′ . a d e b G[{a,b,c,d,e}] c

  9. Similarly, if E 1 ⊆ E then G [ E 1 ] = ( V 1 , E 1 ) where V 1 = { v ∈ V 1 : ∃ e ∈ E 1 such that v ∈ e } is also induced (by E 1 ). E 1 = {(a,b), (a,d)} a G[E 1 ] d b

  10. Isomorphism G 1 = ( V 1 , E 1 ) and G 2 = ( V 2 , E 2 ) are isomorphic if there exists a bijection f : V 1 → V 2 such that ( v , w ) ∈ E 1 ↔ ( f ( v ) , f ( w )) ∈ E 2 . a A d B b D c C f(a)=A etc.

  11. Complete Graphs K n = ([ n ] , { ( i , j ) : 1 ≤ i < j ≤ n } ) is the complete graph on n vertices. K m , n = ([ m ] ∪ [ n ] , { ( i , j ) : i ∈ [ m ] , j ∈ [ n ] } ) is the complete bipartite graph on m + n vertices. (The notation is a little imprecise but hopefully clear.) K5

  12. Vertex Degrees d G ( v ) degree of vertex v in G = number of edges incident with v = δ ( G ) d G ( v ) = min v ∆( G ) d G ( v ) = max v G dG(a)=2, dG(g)=4 etc. b c a δ( G)=2, ∆ (G)=4. g d f e

  13. Matrices and Graphs Incidence matrix M : V × E matrix. � 1 v ∈ e M ( v , e ) = v / ∈ e 0 e 1 e 2 e 3 e 4 e 5 e 6 e 7 e 8 a 1 1 1 b 1 1 1 c 1 1 1 d 1 1 1 e 1 1 1 1 e b c 1 e e 5 e 6 e e 2 4 e 8 e 7 a d e 3

  14. Adjacency matrix A : V × V matrix. � 1 v , w adjacent A ( v , w ) = 0 otherwise a b c d e a 1 1 1 b 1 1 1 c 1 1 1 d 1 1 1 e 1 1 1 1 e b c 1 e e 5 e 6 e e 2 4 e 8 e 7 a d e 3

  15. Theorem � d G ( v ) = 2 | E | v ∈ V Consider the incidence matrix M . Row v has d G ( v ) Proof 1’s. So # 1’s in matrix M is d G ( v ) . � v ∈ V Column e has 2 1’s. So # 1’s in matrix M is 2 | E | . �

  16. Corollary In any graph, the number of vertices of odd degree, is even. Let ODD = {odd degree vertices} and Proof EVEN = V \ ODD . d ( v ) = 2 | E | − d ( v ) � � v ∈ EVEN v ∈ ODD is even. So | ODD | is even. �

  17. Paths and Walks W = ( v 1 , v 2 , . . . , v k ) is a walk in G if ( v i , v i + 1 ) ∈ E for 1 ≤ i < k . A path is a walk in which the vertices are distinct. W 1 is a path, but W 2 , W 3 are not. b d c a e g f W 1 = a,b,c,e,d W 2 =a,b,a,c,e W 3 =g,f,c,e,f

  18. A walk is closed if v 1 = v k . A cycle is a closed walk in which the vertices are distinct except for v 1 , v k . b , c , e , d , b is a cycle. b , c , a , b , d , e , c , b is not a cycle. b d c a e g f

  19. Theorem Let A be the adjacency matrix of the graph G = ( V , E ) and let M k = A k for k ≥ 1 . Then for v , w ∈ V, M k ( v , w ) is the number of distinct walks of length k from v to w. We prove this by induction on k . The base case Proof k = 1 is immediate. Assume the truth of the theorem for some k ≥ 1. For ℓ ≥ 0, let P ℓ ( x , y ) denote the set of walks of length ℓ from x to y . Let P k + 1 ( v , w ; x ) be the set of walks from v to w whose penultimate vertex is x . Note that P k + 1 ( v , w ; x ) ∩ P k + 1 ( v , w ; x ′ ) = ∅ for x � = x ′ and P k + 1 ( v , w ) = P k + 1 ( v , w ; x ) � x ∈ V

  20. So, |P k + 1 ( v , w ) | |P k + 1 ( v , w ; x ) | � = x ∈ V |P k ( v , x ) | A ( x , w ) � = x ∈ V M k ( v , x ) A ( x , w ) � = induction x ∈ V M k + 1 ( v , w ) = matrix multiplication �

  21. Connected components We define a relation ∼ on V . a ∼ b iff there is a walk from a to b . e b d f a c g a ∼ b but a �∼ d . Claim: ∼ is an equivalence relation. reflexivity v ∼ v as v is a (trivial) walk from v to v . Symmetry u ∼ v implies v ∼ u . ( u = u 1 , u 2 . . . , u k = v ) is a walk from u to v implies ( u k , u k − 1 , . . . , u 1 ) is a walk from v to u .

  22. Transitivity u ∼ v and v ∼ w implies u ∼ w . W 1 = ( u = u 1 , u 2 . . . , u k = v ) is a walk from u to v and W 2 = ( v 1 = v , v 2 , v 3 , . . . , v ℓ = w ) is a walk from v to w imples that ( W 1 , W 2 ) = ( u 1 , u 2 . . . , u k , v 2 , v 3 , . . . , v ℓ ) is a walk from u to w . The equivalence classes of ∼ are called connected components . In general V = C 1 ∪ V 2 ∪ · · · ∪ C r where C 1 , C 2 , . . . , C r are the connected comonents. We let comp ( G )(= r ) be the number of components of G . G is connected iff comp ( G ) = 1 i.e. there is a walk between every pair of vertices. Thus C 1 , C 2 , . . . , C r induce connected subgraphs G [ C 1 ] , . . . , G [ C r ] of G

  23. For a walk W we let ℓ ( W ) = no. of edges in W . l(W)=6 Lemma Suppose W is a walk from vertex a to vertex b and that W minimises ℓ over all walks from a to b. Then W is a path. Suppose W = ( a = a 0 , a 1 , . . . , a k = b ) and a i = a j Proof where 0 ≤ i < j ≤ k . Then W ′ = ( a 0 , a 1 , . . . , a i , a j + 1 , . . . , a k ) is also a walk from a to b and ℓ ( W ′ ) = ℓ ( W ) − ( j − i ) < ℓ ( W ) – contradiction. �

  24. Corollary If a ∼ b then there is a path from a to b. So G is connected ↔ ∀ a , b ∈ V there is a path from a to b .

  25. Breadth First Search – BFS Fix v ∈ V . For w ∈ V let d ( v , w ) = length of shortest path from v to w . For t = 0 , 1 , 2 , . . . , let A t = { w ∈ V : d ( v , w ) = t } . A 4 A 2 A 3 A 1 A 4 A 4 v A 2 A 3 A 1 A 2 A 3 A 0 = { v } and v ∼ w ↔ d ( v , w ) < ∞ .

  26. In BFS we construct A 0 , A 1 , A 2 , . . . , by A t + 1 { w / ∈ A 0 ∪ A 1 ∪ · · · ∪ A t : ∃ an edge = ( u , w ) such that u ∈ A t } . no edges ( a , b ) between A k and A ℓ Note : for ℓ − k ≥ 2 , else w ∈ A k + 1 � = A ℓ . (1) In this way we can find all vertices in the same component C as v . By repeating for v ′ / ∈ C we find another component etc.

  27. Characterisation of bipartite graphs Theorem G is bipartite ↔ G has no cycles of odd length. → : G = ( X ∪ Y , E ) . Proof Y X X Y Typical Cycle Y X Suppose C = ( u 1 , u 2 , . . . , u k , u 1 ) is a cycle. Suppose u 1 ∈ X . Then u 2 ∈ Y , u 3 ∈ X , . . . , u k ∈ Y implies k is even.

  28. ← Assume G is connected, else apply following argument to each component. Choose v ∈ V and construct A 0 , A 1 , A 2 , . . . , by BFS. X = A 0 ∪ A 2 ∪ A 4 ∪ · · · and Y = A 1 ∪ A 3 ∪ A 5 ∪ · · · We need only show that X and Y contain no edges and then all edges must join X and Y . Suppose X contains edge ( a , b ) where a ∈ A k and b ∈ A ℓ . (i) If k � = ℓ then | k − ℓ | ≥ 2 which contradicts (1)

  29. (ii) k = ℓ : a v v b j There exist paths ( v = v 0 , v 1 , v 2 , . . . , v k = a ) and ( v = w 0 , w 1 , w 2 , . . . , w k = b ) . Let j = max { t : v t = w t } . ( v j , v j + 1 , . . . , v k , w k , w k − 1 , . . . , w j ) is an odd cycle – length 2 ( k − j ) + 1 – contradiction. �

  30. Trees A tree is a graph which is (a) Connected and (b) has no cycles ( acyclic ).

  31. Lemma Let the components of G be C 1 , C 2 , . . . , C r , Suppose e = ( u , v ) / ∈ E, u ∈ C i , v ∈ C j . (a) i = j ⇒ comp ( G + e ) = comp ( G ) . (b) i � = j ⇒ comp ( G + e ) = comp ( G ) − 1 . (a) v u (b) v u

  32. Every path P in G + e which is not in G must contain Proof e . Also, comp ( G + e ) ≤ comp ( G ) . Suppose ( x = u 0 , u 1 , . . . , u k = u , u k + 1 = v , . . . , u ℓ = y ) is a path in G + e that uses e . Then clearly x ∈ C i and y ∈ C j . (a) follows as now no new relations x ∼ y are added. (b) Only possible new relations x ∼ y are for x ∈ C i and y ∈ C j . But u ∼ v in G + e and so C i ∪ C j becomes (only) new component. �

  33. Lemma G = ( V , E ) is acyclic ( forest ) with (tree) components C 1 , C 2 , . . . , C k . | V | = n. e = ( u , v ) / ∈ E, u ∈ C i , v ∈ C j . (a) i = j ⇒ G + e contains a cycle. (b) i � = j ⇒ G + e is acyclic and has one less component. (c) G has n − k edges.

  34. (a) u , v ∈ C i implies there exists a path ( u = u 0 , u 1 , . . . , u ℓ = v ) in G . So G + e contains the cycle u 0 , u 1 , . . . , u ℓ , u 0 . u v

Recommend


More recommend