Download as pdf
Download as pdf
You are on page 1of 85
. Introduction The basic idea of graph theory were introduced in the eighteenth century by the great swiss mathematician Leonhard Euler to solve the famous Konigsberg bridge problem, which we will discuss in this section later. ” Basically, the graph is the pictorial representation of the problem with vertices (or nodes) and ‘edges (or called lings) connect these pair of vertices. Graphs are used to solve problems in many fields. Graphs can be used to determine whether the two system are connected by a link or not in the computer Network, Graphs with weighted edges can be applied in the transportation Network, Graphs can be used to distinguish between two chemical compounds With the same molecular formula but different structures. 4 Graphs can be used to sort the list of numbers, we can find the maximal flow of a Pipeline network by using graphs efc., In this chapter we discuss the s of graphs, and their applications. a f oon 2 Definition: An undirected graph G = (VG); E consists of a non empty set V(G) called the set ee (points, nodes) of the graph G, E(G) the set of g dges (links) of the graph G, and @ is a mapping from the set of “tees E(G) to a set of unordered pairs of elements of VG). 6.2 Discrete Mathematics For example, Figure 6.1 Graph G where VG) = {%5 Vey Vys Vor Veo Ve} and 2 = Ov) OF (Vp) V,)y seer 28g = (Wy V;), &y = (yy V5) OF (Vey V5) 3 = Wy v,) or Vy ¥,), €; = (Vy, V,) oF (vg ¥,) Definition: The vertices v, and y, in the undirected graph are said to be “adjacent” if there is atleast one edge e between y, and ¥, In this case, the vertices v, and v, are called end points of the edge e. The edge ¢ is also said to be incident with v, and v,. 5 In Fig. 6.1, the graph G, v, and v,, v, and v,, v, and ¥,, are adjacent, but v, and y,, Vp and v,, are not adjacent. If there is an edge from ¥, to v, then that edge is called self loop or simply “loop”. In the graph G, e, = (v,, v,) is called a self loop. If two edges have the same endpoints then the edges are called as parallel edges. In Fig. 6.1, the graph G e, = (v,, v,) and e, = (v,, v,) are called parallel edges. ‘ Definition: The degree of a vertex v in an undirected graph is the number of edges incident with v, self loop counted twice, and it is denoted by d(v). A vertex having no edge incident on it is called an isolated vertex. That is, if d(v) = 0, then v is called isolated vertex, Any vertex having degree one is called a pendent vertex and the corresponding edge is called pendent edge. . Graphs 6.3 In Fig. 6.1, the graph G, dj) =1 d(y,) = 3 diy) = 4 dv) =0 The vertex v, is called pendent vertex, the edge e, is called pendent edge and the vertex v, is called isolated vertex. Multigraph A graph is said to be multigraph if it has parallel edges, Vy % s % Figure 6.2 Multigraph Pseudographs A graph is said to be a pseudograph if it has both parallel edges and self loops. q Vy Figure 6.3 Pseudograph Simple graph =e 5 A graph is said to be a simple graph if it contains no parallel edges and self loops. Here after we shall call a simple graph as a graph. Z ee Trivial graph A graph with one vertex is said to be a trivial graph. Digraph : i i = ists of a non empty set of A directed graph (or) digraph G = (V, E) consists of Vertices V wate edges E, which are ordered pairs of elements of V. “wis adjacent tov, Incase of digraph, an edge = (u, v) denotes the vertex u is adj : ‘Ve say that thea vertex(or starting vertex) is u and the terminal vertex : , ; = 6.4 Discrete Mathematics (or end vertex) is v, but not conversely. But in case of undirected graph both ways are possible. In the digraph, the indegree of a vertex ‘v’ is the number of edges having y as terminal vertex, is denoted by deg” (¥). The outdegree of v, denoted by deg* (v), is the number of edges with v as their initial vertex. (loop will contribute 1 to both indegree and outdegree). Ye y, vy . Figure 6.4 A diagraph Indegree Outdegree av) = 0 &o,) = 1 ad) = 3 ao) = 4 a) =2.. #@) = 0 ‘ Note: 1. Ifthere are two edges having a and vas initial and terminal nodes, then the edges are called parallel edges in a digraph. +2. A digraph having no parallel edges and loops is called simple digraph. Regular graph A graph in which every vertex has k degree is called “k-regular graph. ( 2Regular graph __(ii) Nota regular graph (iii) 3-Regular graph Figure 6.5 Complete graph A graph is said to be a complete graph if any pair of vertices are adjacent. A complete graph having n vertices is denoted by K . whenn =3, K is called a triangle. a Graphs _6.5 Ro : K, K, K, Figure 6.6 Complete Graphs Note that in a complete graph K,,, every vertex is adjacent with the remaining (n-1) vertices of K, and hence there are nC, edges. Note: 1. The number of vertices in G = (V, E) is denoted by |V(G)| and the n(n=1) number of edges is denoted by |E (G)|. Hence |E (K,)| = nC, = 2.K, is m— 1 regular graph. Null graph: A graph is said to be a null graph if it has no edge between any pair of vertices 3 ° °° Figure, 6.7 A NullGraph : Complement of a graph: The complement of a graph G is denoted by GS, where V (G) = V (G°). Two vertices are adjacent in G° if and only if they are not adjacent in G and viceversa. Vi Va vy Tae 6.8 Complement of a Graph Definition: A simple digraph G = (V, E) is called reflexive, symmetric, antisymmetric, transitive etc., if the relation E is reflexive, symmetric antisymmetric, transitive etc., respectively. For example, Ve Vs 6.6 Discrete Mathematics Gis reflexive, symmetric; and transitive His not reflexive; not symmetric, not transitive In H, the vertex v, is the only reflexive vertex. The vertices.y, and Vy v, and v, are symmetric. we have (v,, v,) and (v, v,) in E(H), but (y,, v,) € E(H). So that H is not transitive. Converse ofa digraph Let G = (V, E) be any digraph. The converse of a digraph G is a digraph G =, £ ) in which £ is the converse of the relation E. ie ia. Hes | Ve v5 Me Vs Figure 6.10 Degree Sequence of a graph We represent the degrees of the vertices in the graph G as anon decreasing sequence, called degree sequence of the graph. Let'us consider the graphs. : Ya “¥1 y vs; Px : > é ¥ % v%, % G Figure 6.11 H Degree sequence of G is : 0, 1, 2, 2,3 Degree sequence of H is : 2, 2,3, 3, 4,4. > Definition: Let G =(V, E) be a graph ande € E(G), the deletion of an edge e of G is the graph G —~e, with vertex set V and edge set E— {e}. Similarly, we get the graph G—E’, where E’ CF, e No FM Wo Sy yey, Wee oMicty nev & le, 1G; | i. %wPzOm NOT Oy WO—by,. =o% » 7" Bi € fs enliow e es ° y y, y ¥ OCR ee WG-c Gooey We- tc; 0) Figure 6.12 £ za Graphs 6.7 Definition: Let G'= (V, E) be a graph and v € V(G), the deletion of the vertex v of G is the graph G — v, with vertex set V — {v} and thé edge set E — {set of all edges incident with v}. Similarly, the graph G.— V, can be obtained, where V, ¢ V. For example, w ve % vy Vs v, Vas EVs vy Vs OG WG-y, vy Vy, i vy ° ve vy vs Vs Gi) G-v, (iv) G- vy, v) Figure 6.13 Theorem 1: (The Handshaking theorem) In a graph G -Sd(v) = 2c, ueV where « is the number of edges of G Proof: Since each edge can contribute exactly two degrees to the graph, the sum of degree of all the vertices is equal to twice the number of edges. “Tl The above theorem is also applicable for pseudograph. Theorem 2: In a graph, the number of odd degree vertices are even. Proof: Let V, and V, be the set of all vertices of even degree and the set of all odd degree vertices, respectively, in a graph G=(V, E). é We have, 2e = Zao) = BAM) 4 Ba) veV Since 2e and 220) are even numbers, then ae) is also an even number. We have, sum of odd number of odd terms is odd and sum of even number Of odd terms is even. 6.8 Discrete Mathematics Number of terms in aa” ‘is even. Therefore, the number of odd degree vertices in a graph is even. MI Theorem 3: In a digraph G = (V, E) Ddeg-(v) = Zdeg"(») veV |E(@) Proof: Each edge in a digraph, has exactly an initial vertex and a terminal vertex, therefore, the sum of indegrees and the sum of outdegrees are equal and this is equal to the number of edges. ‘ MI Theorem 4: The maximum degree of any vertex in a simple graph with n vertices isn — 1. Proof: Let G be a graph with 7 vertices and let v be any vertex of G. If vis adjacent with all other n — 1 vertices of V(G), then atmost we get the degree for vas n—1. Since loops and parallel edges are not allowed in a simple graph. Theorem 5: The maximum number of edges in a simple graph with n oe ge BHD vertices is aie Proof: We can prove this by the method of induction on 7. For = I, a simple graph with one vertex has no edges. ~. The result is true for 7 = 1. For n= 2, a simple graph with two vertices may have atmost one edge. t 22-1) _ De The result is true for m = 2. Assume that the result is true for n = k, ie., a graph with k vertices has -l 2 when n =k + 1, let G be a graph having.» vertices and G’ be the graph obtained from G by deleting one vertex say v € V(G). ) edges. ki . atmost A 5 : k(k=)) Since G’ have‘ vertices, then by the hypothesis G’ have atmost eee edges. Now add the vertex v to G'.v may be adjacent to all the k vertices of G’. « The total number of edges in G are, tk = Be = Keen 2 ee simple graph with 7 vertices ig oe Definition: A walk in an undirected graph G = \, E)isa finite non-empty sequence W= Ve VOY y coeseee Yue Mp Consisting of vertices and edges alternatively, such that e, connects, v.,and v,, We say this walk as Yo — v, walk, Note: If v, = VY then the walk is called a closed walk. The number of edges present in a walk is called length of a walk, Definition: A walk W i: is said to be a trail, (or) elementary path if the _ edges of W are distinct, 4 Definition: A walk W is said to be a path, if the edges and vertices of W aredistinct. In other words, a trail is said to be a path ifthe vertices are distinct. Definition: A closed path is said to’be a cycle (or) a circuit, For example: i Ms Figure 6.14 A graph G i : z ¢ i al 0) =" vieiVee Viesvacersaeet losed walk ii losed wi = Vl aMal Vs eVel¥1E2"2 ISAS -W, & W, are not trail. i . i ial, not a = V,e,%_e%2s¥4C0%9 18 a tri a Pal "i V,0,V,6,¥,e4¥, is a closed trial, also a pat = V3 MSE aha P le closed path (or) cycle = Ve gVsls¥125¥30r"s 1S ai pr s is a pal = V,0,40sM1e5%s 18 2 Pi Gi) (i) rote) q 6.10 Discrete Mathematics Remark: 1. The number of edges present in a path is called length of the path, 2. Ina cycle, the number of edges and vertices are equal, called length ofq . cycle, 3. In case of a path or a cycle, we may write Vj¥,¥) + VMs Whenever y,and v,,, are adjacent. (Edges may be left out in between the vertices) 4, If the length of a cycle is even, then we say that the cycle is even cycle otherwise odd cycle. Connected graph An undirected graph is said to be connected, if there exists atleast one path between any pair of vertices of the graph. y, Vs % 1 o_o V, a vs G vs vs H vj i e Figure 6.15 Here G is connected but not H. Since there is no path between v, and v,. In that case, we say H.is a disconnected graph. Paths and cycles ina digraph Definition: A directed walk in a digraph G is a finite non-null sequence W= 196,146, Yy-ne 12% Consists of vertices and edges alternatively, in which each edge ¢, has v,_, asinitial vertex v, as terminal vertex. Definition: A directed trail (ot) directed. elementary path is a directed walk in which directed edges are distinct. : Definition: A directed path is a directed walk in which vertices and edges are distinct. 3 as Definition: A closed directed path is said to be a directed cycle. For example, OF te) Sas 6 y e Vs Figure 6.16 ; A V,2,%,0,%,2,%,0,¥,0,¥6,%, is a directed'walk, but not a directed trail. (i) V,e,¥,2,V,0,02e,¥, is a directed trail but not a directed path. 5 : Graphs 6.11 “ide 1M:06%s 1S a directed path @) ¥,05¥305"4 4e2Y2 is a directed cycle, Defi sfinition: A digraph is said to be connected if there exists atleast one girected path aes every pair of vertices. a (i) Connected tigate (ii) Not connected digraph Figure 6.17 Definition: Let G bea Warsi, we denote 5(G) and AG) the minimum and themaximum degrees, respectively in G. ie, 6(G) min {d(u); ue Vv (G)} and A(G) max {d (u); u € V(G)} Observation 1, For a simple graph G with \V G)|=n, then 0 < 8G) < d(u) < AG) < 7-1, forall ue VG) 2.For a graph G, £8(G) < Yd(v) < ZAG) 3. 4G) < 2 < A@), where E(@|=e _ Subgraphs A graph H = (V(H), E(H)) is said to be a subgraphs of a graph G = (VG), E(G)) if V(H) S VG) and EB) S E(G). A subgraph H of G is said to be a spanning subgraph of G if V (HX) = VG). Definition: A subgraph H of a graph G is said to be induced subgraph 6 ifV dc V(G) and edge set of H is the set of all edges of G having both ends in V(H). In this case we say that the subgraph induced by the vertex set (H), we denote it by G[V(H)]. For example: e S vy fl ” ; Vs A subgraph of G 6.12 _ Discrete Mathematics vs & yw, > e % y, Ae & vs Ys a e; oes A Subgraph of G A spanning subgraph of G Subgraph induced by &y, % ¥) vi & vs a Ys % Y% vy A spanning subgraph of G GC {0 Vy Ve Yh Figure 6.18. Components ofa graph The maximal connected subgraphs of a ai G are called components of the graph G. The number of components is denoted by @(G). o——__——_o Figure 6.19 A graph G Here @(G) = 4. . : Remark: : 1,For.a connected Ae 1G @(G)=1. ‘or a null graph G, having n vertices @ (G)=n, Theorem 6: If Gis disconnected graph, then the complement of G is connected. / Proof: Let G bea disconneeia graph. Then G has atleast two components, say G, and G,. Let yy By over My ANG Vyy Ve ore My be the vertex set of G, and G, respectively. Since G, and G, are components of G, then three is no edge fioui G, to G, inG. So that, each vertex of G,, is adjacent to each vertex ‘FG, in G°. Then it is sufficies to prove one of the graph, say G, is connected in G°. 5 Graphs 6:13 (i) If u, and u, are not adjacent in G then u, and u, are adjacent in G°. (ij) If u, and u, are adjacent in G, then u, and u, are not adjacent in Gs. InG°, both u, ad u, are adjacent to v,. Therefore u, is reachable from u, ee the path u,v,4,. :. GC is a connected graph. WI Theorem 7: A simple graph with n vertices and k components can have (n-K(-k+)) MOS! > em edges. Proof: Let n,, n., ....., 1, be the number of vertices in each of k components of the graph G. Then n, +7, + 2. +n, =n=|V(G)| ' ie, Zn, aie isl k. a - 7 BO @,-1)+@, aligees Gs + (m,- 1) is oe f i it ae = Ln -k=n-k <3 f il Squaring on both sides, we get __ 2 i | +Q,-D < @- “+n2-2n, 41) < (—P [n?-2n, +1 +. $n2-25n, +k <@- le 7 En? -2n+k <(n-k? T — P+ On = kane @ iN ie, zm er of edges of G in its components is Since G is simple, the maximum numb 2% =1) 2 S i *. Maximum number of edges of ny) _ Oo G= x 2 6.14 Discrete Mathematics lA [@-k? + 2n-k-7] [a-khP+@-) Ld ; (n-K (n-k +1) ‘ (n=k) (n—-k +1) -. Maximum nuber of edges of G < mayan? Wheels Wheel W, is obtained:from the cycle C, by adding anew vertex, which is adjacent to each of the 7» vertices of C,, | Ww, ‘ WwW, W, - WwW. Figure 6.20 n-Cubes The n-cubes, denoted by Q,, is the graph with n vertices, which represents 2" bit strings. Two vertices are adjacent if and only if the bit strings differ exactly by one bit position. 10 YW o———___o 0 OfeaT 0 QO Figure 6.21 Union of graphs The union of two simple graphs G=(VE simple graph with vertex set V, UV, and edge set 2 me ee G, is denoted by G, U G,. ea Last = (V,, E,) is the fe union of G, and oy Qe 5 es = ° ° S Gu d G, Figure 6,22 Reachability A vertex vofa simple digraph is said to-be reachable from the vertex u of the same digraph, if there exists atleast one directed path from u to v. In the case of undirected graph if v is reachable from wu, then w is also reachable from v, since the u—y path and v—u path are same. Geodesic Ifa vertex v is reachable from the vertex u, then a path of minimum length from u to v is called geodesic. The length of a geodesic from u to v is called distance and is denoted by d (u, v). ; - Properties of the distance d dtu, v) =0 duu) = 0 du, v) +d (vw) = d(u,w) (Triangle in equality) If v is not reachable from w, then we write d (wy, v) =o. Ina digraph, if v is teachable from w, then it is not necessary that w is also reachable from v, so that d(u, v) need not be equal to d (¥, u). In an undirected graph d (u, v) = (y, u), for all u, v. For example, ~ u v vy Va > p< 4 ; oe ¥; vs Wee » G Figure 6.23 : InG, div) .= 1 diy wy Se 00) diu,x = 1 d(x, u) = © d(uw) a4 d(wyv) = .2 doa) =2 de = 4 6.16 Discrete Mathematics InG, ° dy, v,) = dQvyv,)=1 dv, v,) = d(v,v,)=2 etc, Definition: The diameter of a simple digraph G = (V, E) is given by max d (u, v), for u, veV. % Figure 6.24 InG, diy, v,).= 1 diy, vj 3 dy, v,) = 3 BO, y) = 1 dy, v,) = 3 dvyv,) = 4, etc. ©. The diameter of G is 4. : Remark: 1. In a digraph, if any of the vertex has no indegree then the diameter is 00. 2. In an undirected graph if any isolated vertex is present, then the diameter is <0. 3. For a disconnected graph diameter is oo. Definition: Let G be a digraph, by disregarding the direction of the edges of Ganundirected graph can be obtained. The undirected graph is called underlying graph of the digraph G. , For example, (a) Digraph G (b) Underlyi ; Figure 62 UNdetving graph of G Definition: A simple digraph G is said to be weakly connected-if the underlying graph of G is connected. In the given exam ple, the digraph G is not connecte, reachable from each other. But the underlyin, the digraph is called weakly connected. d, since v, and v, are not 8 graph of Gis connected, therefore Graphs 6.17 For example, vy WY, vy Y, % a y i (a) DigraphG (b) Underlying graph of G Figure 6.26 Definition: A simple digraph is said to be unilaterally connected, if for any pair of vertices of the digraph atleast one of the-vertex is reachable from the other vertex. Definition: A simple digraph is said to be strongly connected, if for any pair of vertices of the digraph both the vertices are reachable from one another. G, is unilaterally connected, and G, is strongly connected. . ¥ “y 4 y / | Ys bees ey w a Yr segunam G Figure 6.27 Definition: For a simple digraph, maximal strongly connected subgraph is - called a strong component. A maximal unilaterally connected subgraph is called. an unilateral component. A maximal weakly connected subgraph is called a_- Weak component. y Ms 5 qi Vs \ Y vy qn Figure 6.28 zs Then {V5 Van Vyp Vado (Ver Yabo {v,} are strong components: 2 {v,, Vay Vay Vyy Vey Ve} and {v,} are unilateral components, and G is a weak* component. ae Theorem 8: In a simple digraph G =(V, E), every vertex of the digraph ies in exactly one strong component. a a 6.18 _Discrete Mathematics Proof: Let v € V(G) and S be the.set of all those vertices of G which are mutually reachable with v. Then v € S, and S is a strong component of G Thi, shows that every vertex of G is contained in a strong component. Assume that the vertex. v is in two strong components S, and S,. Since v & S, and any pair of vertices are mutually reachable with v, and also any pair of vertices of S, are also mutually reachable with v, we get any pair of vertices of S, US, are mutually reachable through v. S, US, becornes One strong component of G. It is not possible. So every vertex of G lies in exactly ong strong component. MN Remark: 1. It is not necessary that every edge of the digraph lies exactly in - one strong component. Consider the example, ‘ yy e Ys %, % Os Ve X ” Figure 6.29 I y The edge e¢ does not lie in any of the strong components {v,, v,, v,} or {Ye Vs Vel : 2. Every vertex and edge of a digraph lies in exactly one weak component. 3. Every vertex and edge of a digraph lies in atleast one unilateral component. » - Definition: Let G = (V, E) be a digraph. The set of all vertices which are reachable from a given vertex v‘€ V(G) is said to be the reachable set of v. The reachable set of v is written.as R (v). For any'subset S © V, the reachable set of S is the set of vertices which are reachable from any vertex of S, and this set is denoted by R(S). i 0 vy We, Vs. a vy, 2 “ % Oo % Vy Ye . Figure 6.30 Note that, ~ © R(v,) = (% v} RO) = {vv v5} ; R@) = (,RO,)= 0). RO) = Oy ¥—y) i R {vy ¥} = {%p ¥, Vp, Vo Ves Vo} Rp My Veh = (My Vy Vy Voy Vp V5} Graphs 6.19 WORKED EXAMPLES 6.1 Example 1: Draw the following graphs? ‘Ke Ga Solution: : rs 6 Example hi ‘Cah a simple graph. exist with Is vertices each of degree 5? Solution: We know that Las o¥d (vy) = 2e Now, 15x53, = 2e 7S. x “. €. = —> isnotan integer. “. Such a graph can not exist. \ Gp Ina graph, the number of odd degree vertices is even, so that, i it is not Possible to have 15 vertices of odd degree. Example 3: How many vertices does a regular graph of degree 4 with 10 edges have? Solution: We have : Ed (v) = Let n be the number of ae and e is the mua of edges. 4n = 2x10 e => T=) *. There are 5 vertices in a regular graph of degree 4 with 10 edges. ree 4: How many edges are there in a graph with 10 vertices each of degree 5? peolution: Let e be the number of ‘educa of the graph 2e = sum ofall degrees = 10 x 5 és e = 25 ~. There are 25 edges. ee 6.20 Discrete Mathematics Example 5: G is a simple graph with 15.e dges and G° has 13 edges, how many vertices does G have? Solution: We have Iv(G)I IE(G UG) Giventhat —_[E(G)] |E(G)| + E(G9] 15413 28x2 = 56 |V(G9| =n and G U G¢ is a complete graph, _n(n-1) nC,=— > 15 and |E(G®)| = 13 n(n-1) 2 ne -1) ? n wn a 1) Pe a 1 VI+AX56 DN: 16 1415 14 4 PE Oe 2 n= 2 (not possible) <. There are eight vertices in the: graph G. Z os 6: If the simple graph G has n vertices and &. edges, how many edges does G° ‘have?. Solution: We have |E(GUG9| IE(G)| + JEG) & + |E(G%| IE(G9) n(n—-1) 2 7. There are W «nC. 2 n(n-1)" 2 n(n=1) De 28 edges in Go, , Te 7: Sh hat if Graphs 6.21" Example 7: Show that if G is a simple ey 7 h Bin of Gand Gr isK, iple graph'with n vertices, then the Solution: We have G U G° as a complete graph having n vertices, since any ra of vertices are adjacent. That is, either it is adjacent in G or adjacent inG*. =, GUGC= K,, if (VG) =n Example 8: Does there exists a simple graph with five vertices of the” following degrees? If so, draw such a graph? Fakes (a) 3, 3, 3, 3, 2 @) 1,2,3,4,5 ()1,2,3.44 @ 3,434.3 (9 0,1,2,2,3 OLLLLI Solution: We have the number of odd degree vertices is even in any graph. Therefore, (b), (d) and (f) are not possible. : : For (a) Yes. For (e) Yes : ; . i | oreo ‘ * For () Not possible. Example 9: Find the complements of the following graphs @K, 0) Kyy () Cn” Solution: (a) Null graph having vertices. * (®) Union of two complete graph having m and n distinct vertices. ie, Ke, = K,UK, : : () C,=K,-EC,) a oa os : , For example, in case of C,. Example 10: If a graph has vertices and a vertex v is connected to a vertex w, then there exists a path from v tow of length no more than (n— 1). Solution: Let vity + Mp. bE a Y= path in a graph G of length m. = + 6.22 Discrete Mathematics The internal vertices of v— w path 1,5 tyy 0-9 Yn 2. The vertices v, 1), thy «+ Uy.» W are not distinct. As G contains only n vertices, it follows that m+11 Now, ° FE) =|EG,UG)| = |EG,)| + [EG))| _ n= =), @=m)nsm— ). = 2 eee By theorem 5) gas : Bi FER Mn (o-m-1)— mine) 1 2 @-1)-nm-m m= 1) + m— m) 1 : © 3 Mm) ~2) +261) — 2m + m2 + m+ mem as 1 : 2 2) + 20-2 2m + 2m] “ lie : 2 IO“ DO@-2)+ 20m) +2 (m9 Graphs 6.23 1 Shy [@- 1) (2) -2n (m1) +2 (m-1) nt DI 1 7 W@-)@-2-2 9-1) @—m-) yeGy. s SPD Since (m- 1) (#-m—-1)20 which is a contradiction <, Hence G is a connected graph. Example 12: Let G be a simple graph with minimum degree 8 (G) > 2 ihen G contains a cycle of length > & + 1. : | Solution: Let G be a simple graph with 5 (G) > 2. i Let p : Uy 4, U, -- u, be a longest path in G.. Claim: The length of the path p =m 2 8(G) If suppose that m <8 (G) . ‘ ; Asd(u,) 2 5 (G), there is avertex v € V(G) such that z,v is an edge and v#u, for all i= 0, 1,2 »m—1. Therefore 14, U, ty. UY 18 apath of length m +1, which is contradiction. Thus m > 8G) eu H As P is a Aongest path, uw, is not adjacent to any vertex in WV (G) — {u,, u,, - Uy) (If u, is adjacent to a vertex w € V(G), then Wi, U, U,... U,, isa path of Jength m+ 1, which is not possible by the ghoice of As deg (u, > 5 (G) U 2,)u, must adjacent to one of the vertex in {u,, u,,..., u,}, it follows that ttt, is an edge for some k > 8 ©). 2. NOW ay Uy Uy ons Ul 1S 2 cyclic of length k+1>8G)t1. <. G contains a cycle of length 7 6(G)t+1. ; : Example 13: Let G be 4 simple graph with n vertices. Show that if 5@ se then G is connected. Solution: Let u and v be any two vertices in G. We show that there is a u~ v path in G If wv is an edge of G, then it isa#—Y path. Consider rv is not an edge of G- 6.24 Discrete Mathematics Let X be the set of all vertices which are adjacent to w and Y be the set of all vertices which are adjacent to v. Then u, v ¢ X U Y (Since G is a simple graph) “(KUY|sn-2 n Wehave |X| = d(u)25(G)2 [| and 0 m = 425@=|3| ; 3 ae 43 xen [2]+[2] e012 “We get |XUY] Now from, IXUY|+|XQNY| = [X|+[Y/ Z IXAY].5 [X|+|¥|-|KUY|> @-1)-@-2)=1 We get IKAY| 21 =>XNY #6 a : Now take a vertex w € X NY, Then epeaat wv are edges, then znvv is an ue v path in G. Thus for every pair of distinct vertices of G there is a path between er :. Gis connected. teas 14; Prove that ife a oor has exactly two vertices of odd degree, there must be. @ path joining these two vertices. Solution: Let G be a graph having exactly two vertices u and v of odd degree. - If G is connected, then there is a u—v Path. . _ LetG be not connected, and let G, be the component of G containing the vertex 1. . We observe that, ~ (i) G, is a connected subgraph of G. (ii) q,, (v) = d, (v) for every vertex 'y of G,. (ij) ue G and d (u) = odd integer. (iv) If v € G,, and u is the only ‘odd degree vertex j in G, then itis a contradiction to the theorem 2. « Graphs 6.25 (@) If v € G,, then, v € G,, and 7 x yy path in G, and hence in G. » and G, is connected, therefore there is a From the case (iv) and (vy) we get there is a u—v path inG Example 15: Check whether the following directed graph is a strongly connected. vy, . ” vy Vy ts Solution: The possible pairs of vertices and their fc } x paths between them are ahowaibelee ; eir aa and the backward ye V;VyV3 OF V,V4V5 We see that, between any pair of vertices : Therefore, the given digraph is a strongly connected. _ there is atleast one path. Bipartite graphs ; A graph G is said to be bipartite ifits vertex set V(G) can be partitioned into two disjoint non empty sets.V, and V,, V, U v,= V(G), such that every edge in E(G) has one end vertex in V, and another end vertex in V,. (So thatno edge in G connécts either two vertices in V, (or) two vertices in V,). i i i Ie in a village, where Consider the graph representing, marriage between peop , €ach:person is aed by a vertex and a marriage 1s represented by an €dge. In this graph, we partitioned the vertex set (people) into two non empty Subsets consisting of Males (V,) and porate paar “i edge (marriage) between one vertex in V, (male) fo @ yore i a ee WM 6.26 Discrete Mathematics For example, Consider the graph G Figure 6.31 Bipartite, graph G. Complete Bipartite graph Abipartite graph G, with the bipartition V, and V,, is called complete bipartite graph, if every vertex in V, is adjacent to every vertex in V,, Clearly, every vertex in V, is adjacent to every vertex in V,. Acomplete bipartite graph with m and n vertices in the bipartition is denoted Figure 6.32 Remarks: 1. K, is not a bipartite graph. 2.C,, is always a bipartite graph. 3, In a complete bipartite graph K,, ,, EK, I =mn and |V(K,,,)[=m +n. Theorem 9: An undirected graph is bipartite if and only if it contains ~ no odd cycle. Fea ae Proof: Let G bea bipartite graph with bipartition (X, Y). Let C, =v, v; v, ¥,., ¥, (where v, = v,) be a cycle inG ~ We may assume that,v,EX. Then (v,, v,) is an edge of G and is bipartite. We get v, € Y. As v, € Y and (v,, v,) is an edge of G, then v, € X. Proceeding like this, we get v,, € X and v,,,, € Y. : z Graphs 6.27 Asy=% EX Kis even. So that C, is an even cycle. Thus G contains no odd cycle. Conversely It suffices to prove the converse for connected graphs. Let G be a connected graph that contains no odd cycle. Choose an arbitrary vertex w and define a partition (X, Y) of V(G) as X = {v€ V(G)| du, v) is even} % Y= {ve€ V(G)|d(u, v) is odd} * Claim ; _ Gisa bipartite graph with bipartition (X, Y). \ Letv and w € X. Let P be a shortest u— v path and Q be a shortest «—w path in G Let u, be the last vertex common to P and Q. Since P and Q are shortest paths, (u, u,) sections-of P and Q are stiortest u— u, paths and therefore have the same length say k. As the lengths of the paths P and Q are even, the lengths of (u, v) section P,, of P and (u, w) section Q, of Q are both either even or Pp If (, w) were an edge in G, then the cycle Q,P," ww is a cycle of odd length. This contradicts to the hypothesis. Hence no two vertices in X are adjacent, Similarly we can prove that no two vertices in Y are adjacent. Thus (X,Y) is a bipartition of the vertex set and G is bipartitite, Wis Remarks i 1. Since the complete graph K, will have C,, for all » > 3. Hence K, is bipartite if and only ifn =2. 2. Cy is bipartite if and only ifn is even andn 2 3. 3. Since W, will have the cycle C,, for all n > 3, Hence, W, is not 1 bipartite foralln 23. ~ i 4. Q is bipartite for alln > 1. 6.28 Discrete Mathematics Graph Isomorphism Since we do not have a unique way to draw the given graph, we may haye two or more different representations for the same graph. It is necessary to ‘Verify whether the two graphs are of the same form, in the sense that there ig a one-to-one correspondence beetween their vertices that Preserves adjacency of the edges. In such a case we say that the two graphs are isomorphic, Definition: The simple graphs G, = (V,, E,) and G, = (V,, E,) are isomorphic if there is a one-to-one and onto function, f from V, to V, with the property that x and y are adjacent in G, if and only if f(x) and f(y) are adjacent in G,, for all x, y € V,. Such a function fis called an isomorphism. Incase of isomorphism, we write G, = G,. 3 However, the definition of isomorphism of two graphs were easy, but the given graphs having n vertices itself has m! ways of one-to-one correspondance, So, one can think of a large n, So, before going for isomorphism, we can verify whether they have the same number of vertices and edges. And if the degree sequence of the graph: are same. If not, then we can say the graphs are not isomorphic. Example 1: We show that the given graphs are isomorphic. uy x, q Xs 4 % u, Figure 6.34 The number of vertices and edges are same. In addition, the degree Sequences are same. Since, in G, we have the vertices v, and v, of degree 3. They must be mapped to the vertices u, and u, in G,. Define a function S:G,>G,as ° f) = 4, (VA) OR wy FO) =u, £0) =u, ‘S,) =u, mnie ested Jim x, f@) = x, ; “1G =, 2 of) = x SF (3) =. x, fe) f x 1 x Graphs 6.29 < Therefore fis a one-to-one onto correspondence between the vertices and edges, the given graphs G, and G, are isomorphic. Note that, we may have another isomorphic function between G, and G,. Example 2: We show that the 8raphs G,and G, are not isomorphic. yy, u, 3 ei : : va Ms Ug us Figure 6.35 ql Inthe graph G,, we have the degree Sequence is 2, 2, 2, 3, 3, but the degree sequence of G, is 1, 2, 2, 3, 4. So that we are not able to find a one to one correspondence between the edges ofG, and G;. Therefore G, and G, are not isomorphic. 5 f ~ Example 3: Given an example of non isomorphic graphs having same number of vertices, edges and degree sequences, ~ Graph G Graph H Figure 6.36 Definition: A Simnle graph G is called self-complementary if G and G° are ‘somorphic. i . Example 1: v w v W. u x H . - : “Ge § Figure 6.37 By renaming the vertices of G®, it is Clear that G janes acelisomorphic. Therefore G is self ‘complementary. s 6:30 _Discrete Mathematics Example 2: Find the self complementary graph with five vertices, Solution: Consider the graph CH G & Figure 6.38 Clearly C, and C,° are isomorphic. 5 ~. Hence C, is self complementary graph with 5 vertices. Theorem 10: If G is self-complementary then it has n =0 (or) 1 (mod 4) vertices. a Proof: Let G be a self-complementary graph with n vertices, then G has —]} nr D edges (since the number of edges in G and G¢ are equal, the number n(n-1) 2 , of edges available in k, is ———). * Then n (or) n — 1 must be even number. ~. Either 4/n (4 divides ) or 4/n-1, therefore n = 0 (or) 1 (mod 4) EXERCISE 6.1 : Part-A’ peitas ‘ : What is an undirected graph? Define adjacency in a graph Define a walk,trail, path and a cycle, Define self: oop ina graph, Define parallel edges ina graph. Define ‘pendent vertex and edge of a graph. Define isolated vetex. Define multi and pseudo graph. Define simple graph. Define digraph. “\ : “ A SYN Semr ay Graphs 6.31 ll. True or false: zi The sum of all degree of vertices of an undirected graph is equal to twice the number of edges of the graph. 12. True or False: ; : ‘ In a graph, the number of odd degree vertices are even. 13, Define regular graph. 14. How many vertices does a regular graph of degree 3 with 8 edges have? 15, Define a complete graph. 16. Drawthe graphK,,K,, 17. Find whether the following graph is y, Vy, reflexive, symmetric, transitive? vs vy 18, Find the complement of the following graphs en ee 4 y Nt 19. Find the induced subgraph of the vertex set {v,, v,,v,} of the graph G. Vs Mare " vy vy 20. Find the diameter of the following = digraph s : - v," We 21, Find the underlying graph G of the following digraph, 6.32 Discrete Mathematics 22. Find the weak, unilateral, strong components of the following graph. ° 23. Define a bipartite graph. 24. Define complete biparite graph. 25. Draw the following graphs K, »K, wae 26. What is the complement of K,? 27. What is meant by isomorphism of graphs? _ 28. What is the complement of C,? where C, is the cycle of length n. 29. True or False: All even cycles are bipartite. ” 30. For which integer n, is C, self-complementary? Part-B 31. IfG be a simple graph with minimum degree 5 (G) = 2, then show that G contains a cycle of length > 6(G)+1. 32. If wand v are distinct vertices in a directed (or undirected) graph G, then show that every u—v walk in G contains a u — v path. - 33. Show that a simple graph with 7 vertices and-& components cannot have 34. Draw all possible subgraphs of a simple graph. 5 - . Za yy Wes eee a 35. Show that if G is disconnected, then G° is connected. 3 Whether if G is connected, then G° is also connected? 36. Show that G is disconnected ifand only ifits vertex set V(G) can be partitioned inito two non empty subsets V, and V, such that there exists no edge in G . Whose one end vertex in V, and the other vertex in V,. 37. Which of the following pair of graphs are isomorphic? KOn* at BOBUEE 6.34 Discrete Mathemati 38. (Referthe definition ofadjacency matrix). aay Are the simple graphs with the following adjacency matrices isomorphic 39. 41. 43. (a) (b) (Refer the definition of inci =or oe Hee 00 1 0 -co i 1 0 1 1 1 0 fo 1 1 1 =o 1 1 0 0 1 1 0 0 0 0 toch. e SSS idency matrix in the next section). Whether the graphs without loops with these incidence matrices are isomorphic? fio Ono ¢ lia rr 10 (@) |o 0 Ot oe Horo 0 0 1 1 erro o- 0 0 1 1 oore Hoe 6 0 1 10 0 Given a simle digraph G = (V, E), under what condition is the equation (v,, v,) +d (vy v,) =d(v, v,) satisfied for v,, v, and v, € V? Find the graph with (n=1(n-2) 2 edges which is not connected. Show that if connected simple graph G is the union of the graphs G, and Gy then G, and G, has at least one common vertex. Prove that if G is self complementary simple graph with |V(G)|=v vertices: then v=0 (or) | (mod 4). ‘i Graphs | 6.35. “Matrix representation of graphs and Digraphs “We can represent a simple graph in the form of edge list or in the form of adjacency lists which are may be useful in computer programming. ye y yee Ys as Ys Vg Vs (a) yi bdr) The Figure 6.39 An Edge list of (a) An Edge list of (6) Vertex | Adjacency *. Vertex | Adjacency vertices vertices ay Vos us vi Ups ¥3 Ye Yq Le Yq mvs Vs Va Vs V3 Ye Vs va Vo V32 Vs, va Vy Ys Vs Vis My oe 5 Adjacency Matrix of a simple graph Definition: Let G = (N, E) be a simple graph with V =.{v,, v,, ...--) V,} where the vertices are arbitrarly listed as v,, v,, The adjacency matrix A (G) = (a) of Gis an » x n matrix with entrices a, 1, if (,¥)¢EG) 0, otherwise Va wherea, = { Note that the entries of A(G) are either 0 (or) 1 is called a bit matrix or a Boolean matrix. The number of 1’s in the column of v, represent the degree “of v, Also, if v, and-v, are adjacent then v, and v, are adjacent in a graph. So, if . i (i jth entry is 1 then (, ith entry also 1. Therefore, A(G) is a symmetric matrix. , Adjacency matrix ofadigraph ~~ Let G = (V, E) bea simple digraph. S 6.36_Discrete Mathematics é trix AG) as The the adjeceny matrix of a digraph is an n x matrix A (G) AG) = @,) Tf ett: (v,,v,) isa directed edge of E(G) \where - a, = ‘ otherwise In case of a simple digraph, (j,,/)th entry is 1 whenever (v, We E@). 4 Note that, if (v, v) € E(G), then we cannot say (vy, v) € EG). So, for a » if y digraph the adjacency matrix A(G) need not be symmetric. Note that, in the adjacency matrix of a digraph, the number of 1’s in the ith row of A(G) is the number of outdegree of the verte: in the jth column of, ‘A(G) is the number matrix-also can be used for pseudograph y, and ¥, are adjacent r times, x v,, and the number of 1’s of indegree of the vertex Y% Adjacericy h. Enter r in the entry (i, ) ifand only if vy v5 For example, Vi Vy Vas Vy Vs MelO 220.80 5 Maul De Omtatewe te 0) 3 Mal deri) resi Si CD vO tee |. a 5100-41100 ¥ Y Vie evn Vy eV, “fo 1 0 0 c, \ 20) 0. 1670 AG) =] 215.200 oi ai MeO eV a1. 0 Figure 6.40 Observe that, if A = AT, find A’, A‘, ,, etc., Theorem 10: Let A be the adjacency matrix of a simple graph G with VEFEICES Vip Ve oom Vy Gi" entry in AP (under usual matrix multiplication) is the number of walks of length r. between the vertices v, and v, of @ Proof: Let us prove this theorem of induction on r, Let G be a graph with adjacency matrix A with reg for a simple graph then AAT = A®, likewise, we can pect to the vertex Ordering ¥,, Vp, , v, of the vertices of G, = t -Ifr=', then . Now, the (i,/)* entry in Ais 1 ifand only if, v) is an edge of G, otherwis® -itis0, . Therefore, the theorem is true, when r= 1, Assume that the theorem is true for r, 1 Graphs 6.37 That is, the (i, j)* entry in A” is the number of different walks of length r . between v, and vy Since, Ant’ = ALA «i, j)* entry in A” where b, is the (i, By induction, 5, is + Tee dot Product.of 7 row of A’ and 7" column of A n Bis ik > thentry of A’]-[ th entry of A] = by ay + By a, + oe +B, a A)” entry of A’. the number of walks of length r from y, to v,. A path of length r + 1 between v, and vis madeup of length r between y, and some intermediate vertex v, to v,, and an edge between », to Vi By the product rule for counting, the number of such paths is the product of the number of paths of length 7 between’ v, and y, ndmely b, and the number of edge between v, and v, namely a, Yy" When these products are added for all possible intermediate vertices v,, we get, (i, k)* entry of A’*! is the number of walks of length r+ 1 between the vertices v, and Vy Results: (undirected graph) Let AGG) be the adjacency matrix of a simple graphG _1. Sum ofall the entries in any row (or) column is equal to the degree of the vertex corresponding to that row or column. 2. All the entries along the Jeading diagonal are zero if and only ifthe graph has no self loops. 3. Given any square, symmetric, binary matrix A of order, one can always Construct a graph G with vertices (without parallel edges) such that A is the adjacency matrix of G. 4, 4 Nth i # /) entry of A?=Number of different paths of length 2 between . Ith and jth vertices, 5.(i, i)th entry of A? = Degree of v,. oa as 6. (i, j)th, entry of A? = Number of different walks of Jength three edges between ith and jth vertices. 7. (i, ith th entry of A? = three through the vertex v,. ude : 8. In ae (i, th (i # j)th entry of A‘ = number of different edge wice the number of different circuits of length. y sequences (walks) of r edges between ¥, and y,, Will Let G =(V, E) be a simple digraph, and v, and v, be any two vertices of G. =(V, - Let A be adjacency matrix of G. Construct the matrix. B, =A Then, we can find ARE ADH ae FAP the number of paths of length r from v, to v,. 6.38_Discréte Mathematics Result: (Digraph) ‘ 1.A and AT need not be equal. If the relation defined on edges is symmetric then A=AT, 2. The sum of ith row = outdegree of v,. 3. The sum of jth column = indegree of v, 4. a, # 0 if and only if there is a self loop at v, 5. The leading diagonal entries of A‘A gives the indegree of the vertices of G : 6. If the (i, j)th entry of B, is k, then & is the number of paths of length r from the ith vertex to jth vertex. 7. IfA is the adjacency matrix for the digraph G, then AT is the, adjacency . matrix for converse of the digraph G. 4 iefAJ’ = Ag Incidence Matrix of a Simple graph Let G = (V, E) be a simple graph with V(G) = {Via veecct v,} and EG) = {e,, é,, ..... €,}, where the vertices and edges are arbitrarly ordered. Then the incidence matrix M(G) = (m,) of G is an n x m matrix with entries \ m, i f J, _ when edge e, is incident with v " Wherem, = 0, » otherwise "For example ys e vy ico a or oHo 3 eae Graphs 6.39 Incidence matrix of a digraph Let G:= (V, E) be a digraph, where |V(G)| = and |E(G)|-= m, then the incidence matrix B = (b;) of G is an n x m matrix with entries 6, where 1, if jth edge having ith vertex as initial vertex sie —1, if jth edge having ith vertex as terminal vertex us 0, — otherwise For Example: vi a % Results: For a simple graph 1. Each column has exactly two 1’s, since an mn egee | is incident with two Vertices, 2. The number of 1’s in each row gives the degree of the vertex corresponding to that row, 3. A row with all zeros is an isolated vertex. 4, If G is a connected graph with 7 vertices and B is its incidence matrix then the rank of B is » — 1. 5. Two graphs G, and G, are isomorphic ifand only iftheir aasiaeace matrices B (G,) and B, G) are equivalent. That is, they. he only by EN off rows and eons 6.40 Discrete Mathematics 2:40 “Discrete Mathematics For a digraph 1. The number of 1’s in any row represents the outdegree of that row Vertex, and the number of -1’s represents the indegree of that vertex. 2. The rank of an incidence matrix with 7 vertices in n — 1. Path Matrix of a simple graph: Let G = (V, E) be a simple graph G and v,, v, are any two vertices of G. A path matrix for the pair (v, v,) is denoted by P (vy, 4). The rows in P (v, u,) correspond to different paths teriecd the vertices v, and v, and the columns correspond to the edges in G. ie, ‘P= @) where 1, if jth edgelies in the ith path Py > 0,» otherwise For example, vy e vy RU ita Come ay s ~ Figure 6.43 Let us find all paths from y, to v,. iy ee Pz = '¥, VY, eV, ey Vy Pee ay Py =-¥, & Vs eV, &, v,e, V5 e poet Gare, @, ese, Cee Oe Eth 0 Palo, ae oO P(,»,) = PO Some t POs a get Also, Py = ey &} Pz = {ey &} Py = (ey en es} are the paths from ¥, to v,. i Graphs 6.41 1\ 0 0.0 \ ov, 0 1 Py) = a 0 heal Results: 1. A column of all 1’s will correspond to an edge which lie in every path between y, and v,. 2.Acolumn ofall 0’s will correspond to.an edge that does not lie on any path between v, and v,. Path Matrix of.a digraph The path matrix (or) reachability matrix, of a dig G=(V, E) with V= {¥,,.V.. --5 Vj} is an n x 7 matrix P = @, ), where 1, if there exist a directed path from vy, to v, Py 0, otherwise For example % y, Be Bees. iy een EO asa oosc.e.f6 s Vs . Ms Figure 6.44 ‘ Circuit Matrix of a simple Graph Let G = (V, E) be a simple graph,. where |E(G)| = m and let there be 7 - different circuits, then the circuit matrix C = Gy ;) of G, is an x m binary matrix, - where e, = | 1 if the jth edge lies in the ith cireuit 0 otherwise : For example, x Gur & a Figure 6.45 6.42 Discrete Mathematics The different circuits of G are Cy = (ey ey &} c, = {ep &y e.} cy = ey ee est : ey eye) 8, 8, 2 Ealithesliscatr’ 0 € LhcA c=% ial Opel plea) Cy | Oy 0 Ae )), vd 0 Circuit Matrix of a digraph Let G be a digraph having m edges and » circuits. Then the citcuit matrix C= ¢, ofa digraph is # x m matrix defined by coe dy if ith circuit includes jth edge and the orientation ofthe edge and circuit are coinciding <1, _ ifithcircuit includes jth edge but the orientation of the edge and circuit are opposite 0, if ith circuit does not include jth edge. Let cr. = fe'se,, -e,) 6, = {eyes et ©, {ey hyp Cop 24) Cy = Ley 24} 1 “ 0 ce) = |i 0 Va pater eS y Figure 6.46 Graph G Graphs 6.43 Shortest path problem. Many problems can be modeled as a weighted graph. Here we mean weight of an edge from one node to the other node may be a travelling time (or) cost etc., ‘An edge having assigned a number is called weighted edge. A graph is said to be weighted graph if all the edges are weighted edges. 125 9 Boston 100 aa San 0. 39 0 a 3 New York Delhi o 100 Los Angles Atlanta Figure 6.47 © Miami We now try to determine a minimum length path between one city to the other, here we mean the length of a path of a weighted graph as a.sum of the weights of the edges in the path (note that length of a path i ina simple graph ans the number of edge of the path). In the above figure one can try to find a shortest length (minimum fare) - een San Francisco to Boston, but there are several paths between them. We have to find a shortest route between them. i Warshall’s Algorithm “Finding path matrix from a given adjacency matrix of a graph) Let A be the adjacency matrix of a digraph G. To produce the path matrix P or A* from the adjacency matrix. 1, Peep cA % k lope : i ee PY (2, A Py) for j from lton fatat Py i « i+1.Ifi Graphs 6.45 Dijkstra’s Algorithm Procedure: (G: weighted connected simple graph, with all weights positive) {Ghas vertices V,, V,, V,, ....., v, and weights w. (v,'v), where w (v, v,) = if vy) is not an edge of G} for i: = lton L(y): = 0 LQ): = 0 Si 6 {the labels are now initialized so that the label of an initial vertex is zero and all other labels are 00, and S is the empty set} While vy, ES | ee begin u: = avertex not in S with L(u) minimal S: = SU {u} for all vertices v not inS if L(w)+wy v) - Eulerian . A graph is said to be Eulerian if it contairls an Euler Tour, Graphs 6.51 For example: raphs vy & A) Figure 6.49 In G,, ¥, &5 Vy &, V3 &p Vz C, Vy Ce Vs @, V, @, V, is an Euler Trail In Gy Vv, &, V, &, V4 3 Vs &y Vy Cy V5 Cy Vs eV, iS an Euler Tour InG,, v, e, V2 2, Vs & Vz & Vz @, Vs @, V, is a Tour but not Euler Tour. But v, 2, V, €, V; @, V, @,¥, is an Euler Tour. Theorem 12: A connected multigraph has an Euler Tour if and only if each of its vertices has an even degree. Proof: Let G be any graph having an Euler Tour and let C be an Euler Tour of G with origin (and terminus) vertex as u. Each time a vertex v.occurs as an internal vertex of C, then two of the edges incident with v are accounted for degree. i We get, for internal vertex v € V(G). d(v) = 2%number of times v occur inside the Euler tour C = even degree . and, since an Euler Tour C contains every edge of Gand C starts and ends at w. d(u) = 2+2%* number of times u occurs inside C i = even degree ‘:. Thus, G has all the vertices of even degree. Conversely: Let G be a connected graph which vertices of even degree and less numbs | less number of edges than G, then it has an Euler Tour. Since each vertex of G has degree atleast two, therefore G contains a closed trail. Let C be a closed trail of maximum possible lengthy in G.IfC itself itself an Euler Tour in G. C is not an Euler Tour ")| > 0. C has less nu: \ x es all the vertices ofeven degree, thus the connected is not having an Euler Tour, with all ; G-EC has some By assumption, of G angie © component G’ with |E( itself is an Eulerian, and C er of edges. That is, any graph having ~ has all the edges of G, then C mber of edges than G, therefore C- ed 6.52 Discrete Mathematics graph G' also has all the vertices of even degree. Since |E(G’)| <|E(G)|, therefore G'has an Euler Tour C’, Because G is connected, there is a vertex v in both C and C’. Now j join C and C and‘tranverse all the edges of C and C’ with a common vertex v, we get CC’ is a closed trail in G and E(CC’) > na which is not possible for the choice of C. MN Theorem 13: A connected graph G is Eulerian if and only if it can be decomposed into cycles. Proof: \f G can be decomposed into cycles, then G is a union of edge disjoint cycles. Since the degree of every-vertex in a cycle is two, therefore the degree of every vertex in G is even. Hence G is Eulerian. Conversely: Let G be Eulerian, then degree of every vertex is even, therefore the minimum degree of every vertex is atleast 2. Therefore G contains a cycle C,. Now consider G—E(C,) again degree of every vertex is even (or) zero in G—E(C,) ie and it has a connected component in which every vertex has atleast degree 2. -. G-E(C,) contains a cycle C, in its connected component. Consider the graph G—E (C, UC,). As degree of every vertex in G is even, the graph G — E (C, U C,) contains a cycle C,,. Continue this process until no edge is left. At the final stage we obtain a decomposition of G into a union of edge disjoint cycles. Algorithm to find Euler Tour: : \ Procedure: Euler (G:. connected multigraph with all vertices of even degree) * Circuit: = A circuit in G beginning at an arbitrarily chosen vertex with edges successively added to form a path that returns to this vertex. ' H: = G with the edges of this circuit removed: While H has edges. i begin subcircuit: =A circuit in H beginning ata vertex in H that also an end point of an edge of circuit. H: =H with edges of subcircuit and isolated vertices removed. Circuit end {circuit is an Euler circuit} Ml Circuit with subcircuit inserted at the appropriate vertex. Theorem 14: A connected multigraph has an Euler’ trial (but not an Euler Tour) if and only if it has exactly, two vertices of odd degree. Graphs 6.53 Proof: Let G be any connected graph having Euler Trail. By the above theorem, each vertex other tl trail has even degree. than the origin and terminus of this . Conversely, suppose that G is non trivial connected graph with two vertices uand v of odd degree. Consider the graph G + e, (e = uv) each vertex of G + e is even degree, then by the above theorem, G+ehas an Euler Tour, let C be an Euler Tour, then delect an edge e = uv from C, we get an Euler trail C—e of G Mt Konigsberg Seven bridge problem In a town of konigeberg, Prussia was divi branches of the preger river. These four Tegi as indicated below. we AZZ Ze Figure 6.50 The problem is, whether it is possible to travel’all the bridges exactly once from Start to end of any town. ided into four sections by the ions are connected by seven bridges The Swiss mathematician Leonhard Euler solved this problem in 1936, He represented the seven bridges as seven edges and the four places as four vertices, he got a multigraph as shown below. ; Cc BFigure 6.51 Since the above graph has more than two vertices of odd degree, we cannot have even an Euler trail. Therefore, it is not possible to traverse all the bridges | ©xactly once from start to end of any town. a wr 6.54 Discrete Mathematics » Hamilton path and cycle 4 Definition: A Hamilton path of G is a path that contains every vertex of G A Hamilton cycle of G is a cycle that contains every vertex of G A graph G is said to be Hamiltonian if G has an Hamilton cycle. Example: y% e ys & Ys ' Ys & Ms Figure 6.52 Consider, P, = v,é,-¥, €, ¥; eV, é, v, is a Hamilton path Pa "; V> €, V; &, V, is a path but not Hamilton path C, = Ye, Vs €y Vy e, V, & Vs & Y, is a Hamilton cycle : C, = v,e,¥, &, ¥; &, V, @ ¥, is a cycle but not Hamilton cycle. Round the world problem. The problem consisted of a wooden dodecahedron with a peg at each vertex of the dodecahedraon and string. The 20 vertices of the dodecahedron were labeled with different cities in the world. The object of the puzzles was to start at a city and travel along the edges of the dodecahedron, visiting each of the other 19 cities exactly once, and return back to the first city. A Hamilton cycle isa solution to this problem, which is indicated in the following diagrams. Figure 6.53 Graphs 6.55 Theorem 15: If G is hamiltonian, then for every non empty proper stibset S of VG) with. i @(G-S) <|s| Proof: Let C be a Hamilton cycle of G. * Then, for every non empty proper subset $ of V(G). o(C-S) <|s) : Also, C —S is a spanning subgroup of G—§ and so o (G-S) < @(C-S) <|g| Hence the theorem. : 4 Wit Theorem 16 (Dirac’s Theorem): If G is a connected simple graph with nyertices where n> 3, then G is Hamiltonian if the degree of each vertex is atleast > it 2 Proof: Suppose that the theorem ig falsej.and let-G be a maximal non Hamiltonian simple graph-with n= 3 and the degree of each vertex is atleast 2 Since n = 3, G cannot be complete. Let u and v be non adjacent . Yertices in G. Since G is the maximal non Hamiltonian, G+ wy is Hamiltonian, each Hamilton cycle of G + uv must contain the edge uv. Thus there is a Hamilton path v,y, ..... v, in G with origin u = y, and terminys v= v,._ Let S = {,€V(G)|(%,,) ERG} — x ah and, T. = -{vy,€ VG)| pv) € E@}, wherei=lton . Since v, ¢ S UT we have |S U T| ; se memes 6.56 Discrete Mathematics Theorem 17 (Ore’s Theorem): Let G be a simple graph with n vertices with n = 3,and let u and v be non adjacent vertices in G such that d (w+ d@2n. Then G is Hamiltonian if and only if G + uv is Hamiltonian. Proof: If G is Hamiltonian then, trivially, G + uv is Hamiltonian, Conversely, suppose that G + uv is Hamiltonian but G is not Hamiltonian, with d(ujt+d(v) 2n and each Hamilton cycle of G + uv must contain the edge uv. Thus there is a Hamilton path », y, ..... v, in’G with origin w= v, and terminus v =v, Let S = {v,| (u, »,,) € E(G)} and T = {| (¥,v) € EG)} suchthat |SUT| < nand|SnT|=0 Since if S'N T contains some vertex. y; then G would have the Hamilton cycle ¥, vy... VE VGE EI, lv fi in md AL It” This contradicts the assumption By |S UT| < nand|S NM T|=0, we get d(u)+d(v) = |[Sj+T|=|SUT|+|SAT| n. + *, Gisalso Hamiltonian. a mi Definition: The closure of G is the graph obtained from G by recursively joining pairs of nonadjacent vertices whose degree sum is atleast [V(G)| untill no such pair remains. We denote the closure of G by C(G). ‘ OO8S . Figure 6. Corallary: A simple graph is Hamiltonian if and only if its closure is Hamiltonian. : Proof: By applying above theorem, each time a new edge is added in the formation of closure. WL __a€/ Graphs 6.57 Corollary: Let G be a simple graph with n > 3. If C(G) is complete, then G ishamiltonian. Theorem 18: If n > 3, is odd integer, then the complete graph K, -1 contains a 2 edge-disjoint Hamilton cycles, iH | r n(n-1) Proof: Each Hamilton cycle in K, consists of n edges. As K, has Cage n-1 edges. K, can have almost Ou edge disjoint Hamilton cycles. Example: For K,: is the only Hamilton cycle. es 1 baie 4 8 2 SON. Ss For K,: ce Ae 3 ante 3 4 _ are the only Hamilton cycles. For K, ae are the only 3 possible 7-cycles in K,. 6.58 Discrete Mathematics WORKED EXAMPLES 6.3 Example 1: Show that K, is Hamiltonian whenever Solution: XK, contains C,, for all n > 3. -. K, is Hamiltonian, V n > 3. n> 3. Example 2: Give an example of graph which is () Eulerian and Hamiltonian (ii) Eulerian but not Hamiltonian (iii) Hamiltonian but not Eulerian (iv) Neither Eulerian nor Hamiltonian Solution: (i) Let us consider a connected graph G with n vertices with d(v)=even and d(v) > s Wv € V, will be an Eulerian as well as Hamiltonian. For example, (or) Let us consider any cycle C,, for n > 3. For example, C, is an Eulerian and Hamilthonian graph (ij) Let us consider a connected graph G, in which d (@) = even, forall Vv € V(G), but fails to have a cycle with all the vertices of G © For example, Graphs 6.59 (iii) Let us consider a connected graph G such that a cycle having all the vertices of G but some the vertices are odd degree. For example, (iv) Letus consider a connected graph G having odd degree vertices such ~ that a cycle does not having all the vertices og G. For example, Example 3: For which values of n'do these graphs have an Euler circuits? . -@K, WCOW, @Q, Solution: (a) K, have an Euler circuit, ifn is odd andn > 3, because ey 2n regular. (®) C, have an Euler circuit, for all n > 3, because every cycle C, itself an Euler circuit. (c) No W, have an Euler circuit, for all n > 3. (a) Since, Q, is a n-regular graph. ; -. Q, have an Euler circuit, if n is even and n > 2. Example 4: For which values of n are these Hamiltonian? @K, COW, @, Solution: (a) K, is Hamiltanian, for all n > 3. (6) C,is Hamiltanian, for all n > 3. (©) W, is Hamiltanian, for all n > 3. (@) Q, is Hamiltanian, for all n > 2. Example 5: For which values ofm coe n does the complete biparlite Sraph K, , have (a). an Euler circuit? . (b) An Euler path?’ (c) ‘A Hamilton cycle? (d) A Hamilton path? 6.60 Discrete Mathematics Solution: 4 (@) K,, have an Euler circuit, if for even values of m,n > 2. (®) X,,, have an Euler path, if @ forn=1 and m= 1,2 (ii) for n = 2 and an odd integer m > 1. (c) K,, have a Hamilton circuit, if for m=nandm,n> 2. (a) K., have a Hamilton path, for m=n+ 1 and m, n> 1. Example 6: Determine whether the following graph has an Euler circuit, Construct such a circuit when one exists. Ifno Euler circuit exists, determine whether the graph has an Euler path and construct such a path if one exists. a b of ® c d e a 6, e © es mad: Solution: (a) The given graph have more than 2 vertices of odd degree, hence it does have an Euler circuit as well as Euler path. (}) The given graph contains two odd degree vertices, hence it does not contains an Euler circuit, but it contains an Euler path, namely bacdefdba, a ; (¢) The given graph does not have an Euler circuit, but eabcdbed as an Euler path, (d) The given graph having even degree for the vertices, hence it contains an Euler circuit, : : Example 7: Find the least number of times it is necessary to lift a. pencil from the paper when drawing each of the following graphs without retracing any part of the graph. a! Graphs 6.61 i 6 oe et Solution: ; : (a) When we trace the graph we need to find an Euler path which must start from any one of odd degree vertex then the Euler path must end at another odd degree vertex of the graph. Here, there are 4 vertices of odd degree, hence, we need to. lift pencil necessarly once. : g (b) There are 8 vertices of odd degree, hence we must lift the pencil three times. (c) There are 6 vertices of odd degree, hence we must lift the pencil two times. (d) There are exactly two vertices of odd degree, therefore it contains an Euler path. Hence, we can trace the graph without lifting the pencil. 3 The Travelling Salesman Problem Asalesman starts from his home and plans a trip to visit 2 — 1 other places and return back to home. The natural objective isto minimize the total travelling time. If we assign each edge of K, of a weights equal to the travelling time between the corresponding places, then we seek a Hamilton cycle with minimum total weight. This problem is known as Travelling Salesman problem. No such efficient algorithm for solving the travelling salesman problem is known. It is therefore describe to have a method for obtaining a reasonably good (but not Necessarily optimal) solution. Neares-neighbour Algorithm : : Let v,, Vj, sss ¥, be the vertices of K, and w, denote the weight of edge Vis y. ) . ‘i From an arbitrary starting vertex, move to a vertex via the least cost incident ees and continue always visiting unvisited neighbours of the current vertex. ntil we visit all the vertices and return back to the starting vertex. 6.62 Discrete Mathematics Consider the weighted graph K,. it Figur46.56 Let-v, be the starting vertex, (@) From y, go to y, (since w (¥,, v,) is minimum) (ii) From v, go to Wp (iii) From v, goto Vs (wv) From v, goto v,. (v, is visited vertex, v, is starting vertex) (v) From v, goto ve Figure 5.57 The travelling route is v,v,v,v,y,¥,. ~. Total-weight of the circuit = 16 miles. Another method: The travelling salesman problem asks for the circuit of minimum total weight in a weighted complete undirected graph that visits each vertex exactly once and returns to its starting point. This is equivalent to, asking for a Hamilton cycle with minimum total weight in the complete graph. We now give a most straight forward method to solve the travelling salesman problem. A complete graph having 1 vertices will have (n ~ 1)! different Hamilton circuits. Since, if we choose a starting vertex, then there are n — 1 choices for the second vertex, n — 2 choices for third vertex, and so on. Since a Hamilton ; (n=)! circuit can be travelled in reverse order, we need to only examine > circuits. This method can be applied only when the graph have few vertices: For example, consider the above example (fig. 6.68). ee Graphs 6.63 -1)! ow a oe = 12 Hamilton cycle are to-be examine. No. \_ Route © Total Distance 1 V{V2MaVa"5¥i 24+44+44+24+6=18 2. VyV2VsVeVaMi .24446424+5=19 3. vvwowy, | 24542444+3=16 4. VVAVSVS% AM 24+5+6+4+5=22 5. VVQV4V5V3Y, 24+34+2+64+3=16 6. TARAS 24+34+4+6+6=21 th ViV4V2V55Y) 54+34+44+64+6=24 8. ViV4¥2%5"5¥1 54+34+54+64+3=22 9. VVAMsV2¥5V 1° 54+24+54+443=19 10. V{VqV3V2¥5¥) 54+4+44+54+6=24 ne ¥,¥,¥4P2"5"1 34+4434+5+6=21 125 ViV5V2V4V5¥1 3+44+34+2+6=18 The optimal travelling route is either v,v,V;¥,3Y; OF ¥iV2¥4Vs¥3¥i- Part-A. x Define Euler Tour. Define Eulerian graph. Define Hamilton cycle. Define Hamiltonian graph. Define closure ofa graph G. vee True or False: A graph G.is Eulerian if and only ifevery vertex of Gis ofeven degree. Part-B , 7. Show that, a simple graph is Hamiltonian if and only if its closure is Hamiltonian. 8. Suppose that v is a end point of a cut edge. Prove tha v is a cut vertex if and only if this vertex is not pendant. aweener 6.64 Discrete Mathematics 9. 13. 14. Find the Euler tour in the following graphs, if it exists? Show that an edge in a simple graph is a cut edge if and oii if this is nota part of any cycle in the graph. Ifthe union of two graphs G, and G, is connected, then G,and G, have atleas one common vertex. Solve the following travelling salesman problem. Show that a directed multigraph having no isolated vertices has an Euler tour if and only if the graph is weakly connected and the in-degree and out- degree of each vertex are equal. ; For what value of n the following graphs are Eulerian OK, (i) C, (ii) Wy Cv) Q, Show that if G is edge connected then |E(G)| = k ——— | “ {MG} then k(G)<6(G). Whether the following graphs are Hamiltonian. For Hamiltonian graphs find Hamiltonian cycle. Cut edge An edge e ofa apt G is said to be cut edge of G if a (G—e)> @(G). That is by deleting an edge ‘e’ in S it will i pncrenSS the number of components geste graph G. _ Example: : Ms 4 v, vy e vy, iS e, a & ° i e Wg Ve a Graphs 6.65 Show that if G is simple and 3-regular, then K(G)=K(G). Show that if G is simple and d (G) = |V(G)|-2, then K(G) = 8 (G). Show that if G has a Hamilton path then, for eve subset S of V(G), wG-S)<|S|+1. Soe ea that if a graph is self-complementary then the graph has a Hamilton Ca all possible Hamilton cycles of K,K,. Determine whether the following graph has an Euler circuit. Construct such a circuit when one exists. If no Euler circuit exists, determine whether the graph has an Euler path and construct such a path if one exists. OED oa Trees 6.66 Discrete Mathematics vy i Ye, Vy vi Ov Vs a M2 Vy e, 2, e, e e e es & VY; YG v% Vs Vy vy @ Vs Vol Ww e Is Ves " e 5 H H-e, H-e, Since @ (G-e,) = 2 and @ (G) = 1, we get e, is an cut edge, bute, is nota cut edge. We have w(H) = 2, and w (H — e,) = 3, hence e, is cut edge of H, since w (H-e,), hence e, is not a cut edge of H. Cut vertex A vertex v of a graph G is a cut vertex if @ (G— v) > @(G). For example, ey, % ° fe Ms Dy a¥s G-y, “G-yv, Figure 6.58, y, isa cut vertex but y, is not. First we study a tree in undirected simple graph (no loops and parallel edges). Definition: A graph having no cycle is said to be acyclic graph. Definition: An acyclic graph is said to a forest. Definition: A connected acyclic graph is said to be a ‘tree’. By the definition of a tree it is clear that the tree has no loops and parallel edges. i.e., every tree is a simple connected acyclic graph. For example, vi . Cyclic Graph ; Forest Tree = Figure 6.59 . Graphs 6.67 One can observe the following vy (i Ina cycle, any two vertices are connected vs by two different paths. The vertices v, and v, are connected by two paths namely VV ANA VAV3V4M5Mo° Since, a tree has no cycle, so that no two vertices are i connected by two different paths. v, Also tree is a connected graph. So that any pair of Figure 6.60 vertices are connected by a unique path. (ii) Ina tree, The number of vertices — 1 The number of edges. (iii) All the internal vertices are cut vertices. (iv) All the edges are cut edges. These observations may lead to the consecutive theorems. Theroem 19: An undirected simple graph is a tree if and only if there is a unique path between any pair of its vertices. Proof: Let G be a tree, and u, v € V (G), (u# v). Suppose that there are two distinct u — v paths P, and P, in G. The path P, followed by the reversal path P,' of P, is a closed path (cycle) in G, which is a contradiction to the fact that G is acyclic. ext .. There is a unique path between any pair of vertices in a tree. Conversely, Let G be a simple graph and any pair of vertices are connected by a unique path. Therefore G is connected. Suppose that G contains a cycle C, then there are two adjacent vertices u and v on the cycle. We can find two different u— v paths uv and C — wv between u and vin G which is a contradiction to our assumption. 2G contains no cycle. ~. G isa connected acyclic graph, ie., G is a tree. Mt Theorem 20: A tree with n vertices has n — 1 edges. : . Proof: We prove this result by induction on the number of vertices of a tree Ty : Consider, p (n) | A tree with vertices has n — 1 edges. If n = 1, then the simple graph with only one vertex is k, which has 9-1-1 edges, So that p(1) is true. ; . Let us assume that p (”) is true for all n < k, for some k > 1. a Let T be any tree having k + 1 vertices. Lete = 0” é Oe bet edge inT. As T isa tree, uev is the only u— “y path in T connecting u ‘. Te is a disconnected graph. That isT-e co exactly two components say T, and T, having k, and k, vertices respectively. where 1s. k< *+1 1 < k< k+l and kth, = k+l Let us use the hypothesis for T, and T,. T, has k, — 1 edges and T, has heal edges. The number of edges in T " The number of edges in T, + The number of edges in T, + 1'(for the edge e) (-D+G-+1 t = k+k-1 = (k+ 1) I(since k, +, = k+ 1) k p(k+ 1) is also true. ‘ <. The statement p (7) is true for all ». 3 A tree with 7 vertices has n — 1 edges. ML Theroem 21: Let G be a graph with n vertices and n — I edges. Show that the following statements are equivalent (i) G is connected, (ii) G is acyclic, (iii) G is a tree. Proof: (i) — (ii) Let G be a connected graph with n vertices and n- 1 edges. If suppose G has a cycle C(k). Clearly C(k) has k vertices and k edges. Since G is a connected graph, so that to make connections of remaining n— k vertices we need atleast n — k edges. <. Ghas k (in C) + (1 — k) = edges. Which is a contradiction. «. Gis acyclic. Gi) > (tii) Let G be acyclic graph with n vertices and n—1 edges, ~ To show that G is a tree, it is enough to show that G is a connected graph > Graphs 6.69 ifsuppose G isa disconnected graph, then G has atleast two components G, and G, With k, and k, vertices respectively. (where k, + k, = 7). Now G, and G, are trees, since they are connected acyclic graphs. Therefore, G, and G, has k, — 1 and k, — 1 edges respectively. +, The number of edges in G = &-1)+@-) = k+k-2 =n=-2 which is a contradiction +, G is a connected graph. ie., G is a tree. (iil) > @ Let G be a tree with 7 vertices and 7 — ledges. By the definition of a tree, G is a connected graph. Mt Remember: An edge e € G is said to be a cut edge of Gif w(G-e)>w (G). The cut edges are indicated as track lines. Figure 6.61 The Cut Edges of Graph Theorem 22: An edge e of G is a cut edge of G if and only if e is not contained in any cycle of G 2 ‘Proof: Let e = xy be a cut edge of G. Since @ (G — ) > @ (G), then there exists vertices u and v of G that are connected in G but not in G—e- . Therefore, some u — v path P in G, whi e=xy. InG—e, u is connected to x by a sectio section of P. ich necessarily traverse an edge n of P and y is connected to v by If suppose e lies in a cycle C of G. The vertices x and y would be connected in G — e by the path C — e. Thus, u and y would be connected in G—e, which is a contradiction. 4 Conversely, Let é = xy does not lies in any cycle of G. If suppose that e = xy is not a cut edge of G. Thus, removal of e from G would not increase the components of G. ie, w(G-e) = w(G) : Since there is ax —y path (namely e = xy) in Gx and y are in the same component of G. It follows that and y are in the same component of G—e, and hence there is an x —y path P inG-e. Now consider the path P in G—e together with an edge ¢ of G is a closed path. That is P + ¢ is a cycle in G: Therefore ¢ lies in a cycle. Which is a contradiction. MIL Theorem 23: A connected graph is a tree if and only if every edge is an cut edge. i Proof: Let G be a tree. Then G is a connected acyclic graph. Let e = uv be any edge of G. If suppose that e = uy is not a cut edge of G then G — e is connected. Therefore there is a u—v path P in G — e. Now that path P together with the edge e will form a cycle. Which is not possible in a tree. _ Conversely, let G be a connected graph with each edge is'an cut edge. If there is a cycle C in G select e be any edge in the cycle C. Then G —e is also connected. Therefore e is not a cut edge . which isa contradiction. ///// Definition: A connected graph is said to be minimally connected if removal of any one edge from it will disconnect the graph. Thats, a connected graph is said to be minimally connected if and only ifall the edges are cut edges. Theorem 24: A graph is a tree if and only if it is minimally connected. (The proof of the above theorem can be reformed) MI Definition: A spanning tree of a graph G is a subgraph of G, that is a tree containing every vertex of G. : So that every connected graph there is a spanning tree. Figure 6.62 A Spanning Tree in a Connected Graph a Graphs 6.71 The number of spanning trees in a connected graph G is denoted by t (G) and is said to be the complexity of the graph G. Definition: Let e =w be any edge of a graph G. The contraction of e is the operation of replacing u and v by a single vertex (u, v) whose edges are the edges other than e that were incident on u or v. The resulting graph, denoted by G .e u & x asa 2 e aa e y & y Ye e ~y c Ge, : Figure 6.63 Remark: 1. |BG-e| = E@I-! d 2. The graph G . e may have parallel edges. 3. |VG.e] = V@Ol-! 4. o(G.e) = o@) 5. If T is a tree, then T . e is also a tree. Theorem 25: (Cayley Theorem) Ife is an edge of G then «(G) = 1(G-e)+1t(G.e) Proof: Let S be the set of all spanning trees of G. Now the set S can be Partitioned as S, U S,, where S, is the set of all spanning trees of G not containing eand S, is the set of all spanning trees of G containing the edge e. _ Aspanning tree T of G does not contain ¢ ifand only if T is a spanning tree inG—e, : We have, s\| = +(G-2) Ifa spanning tree T of G contains ¢ then T . ¢ is a spanning tree in G . e. Also every spanning tree in G .¢ is T .e for some spanning tree T of G that contains ¢. So there is a bijection between S, and the set of spanning trees of Gee, Thus Is] = <(G.2) Hence «(G) = IS=IS + 1S|=+(G—-e)+7(G.e) Mill 6.72 Discrete Mathematics We find a eee se of the given graph G. The graph G is connected, but not a tree. Now, we remove self loops and parallel edges. We get a simple graph G’ with cycles, now we remove an edge from each of ne circuit, Ls lea Tree T, Tree T, Now T, & T, are the spanning trees of G. Remark: 1. Spanning tree in a graph need not be unique. 2. A cut edge of a graph G will be present in each of the spanning tree of G Minimum spanning tree , Remember that, a graph G i is said to be a weighted graph if all the edges in in G are weighted edges. The weight of the graph G is the sum of weights of the edges in the graph G It is denoted by W(G). Definition: A spanning tree T of a weighted graph G is said to be minimum. spanning tree if the weight of T is minimum among all spanning trees in G Consider the graph G y 7 % 7 wy No 7 V5 6 3 5G 5 5 . y z vy. Ww yy 2 Me G 1, T : Graphs 6.73 % v, Vy v 6 4 6 4 5 ve 2 vy, Vy v5, Ww Ty Figure 6.64 Now, The weight of T, = w(T,)=6+7+5=18 w(T,) = 14 w (T;). = 12 w(T,) = 15 - Here T,, T,, T;» and T, are spanning trees in G. But w(T,) is the minimum i weighted spanning tree. i.e., minimum spanning tree of the given graph G. Note that the minimum spanning tree of the graph need not be unique. Consider the graph 4 4 4 2 3 1] eee 1 3 1 4 . 26 1, i * Figure 6.65 Now w (T,) = 10 = (T,), both T, and T, are minimum spanning trees. Algorithm for minimum spanning trees (Kruskal’s algorithm) We now present an algorithm to find a minimum spanning tree in aweighted Staph. Step 1: Choose a link e, such that w (e,) is as small as possible. Step 2: If edges e,, 2» ----- & have been chosen, then choose an edge @,,, from EB (4) Cy oo »,} in such a way that W) G [fey C29 +++ .. &}] is acyclic. Gi) w ¢,,,) is as small as possible subject to i. Step 3: Stop when step 2 cannot be implemented further. UL For example, We find the optimal tree of the following graph G Solution: List all the edges of G, with respect to the weight of the edges. 6.74 Discrete Mathematics Edge | Weight | Selection (uy %) 1 % (uy u) 1 SL (os w) | Biel ags (uy 4) 2) v (uy u,) 2) x (uy, 4) 3 ¥ (uy u,) 3 v (uy Us) 4 x Figure 6.55 ug u;) 4 v (uy 4) a Stop *, (uy 4) 5 (Us, u,) 6 4, Figure 6.66 Optimal tree of G Theorem: 26: Any spanning tree T’ = G [{@,, yy --.-» e,}] constructed by Kruskal’s algorithm is an optimal tree. 5 Proof: Let T be the spanning tree constructed by the Kruskal’s algorithm from the graph G with |V(G)| =n. If T is not connected; then as tlie original graph G is connected, there are edges in G which join different components of T. So for each one of such edge e, the Spanning graph T + e is acyclic and hence the algorithm cannot stop at this stage, which is a contradiction: Thus the spanning graph T is connected and so it is a tree. Let E(T) = {e,, @,, ......€, ,}, Where e, is the edge chosen in the ith iteration of the algorithm. Let T* be an optimal spanning tree, If T # T*, let ibe the least positive integer such that the edge e, is not in T*, T* + e contains a cycleC. The cycle C contains atleast one edge e’ which is not T (as T is acyclic) Sy > Graphs _6.75 Now, qT* +e,—¢' isa spanning tree, (i Ase’ is not in T, € # ey ey) nn, (fi) AS ey» Gp o> e,,¢" are in T*, the spanning graph H, with E(H,) = (¢,, ad } is acyclic. So the edge e’ is also available for consideration at Bie of the algorithm. Since edge ¢, has been selected at that iteration instead of the edge e’. We have W(e,) = W(e') ih (iv) w (T* +e, =e) = 0 (1) +w (e) we’) < w (T*), (by above step)’ 4 AsT* itself is an optimal spanning tree, we have w (T* + e,—e') = w(T \C. 2-2) i We have obtained a new optimal tree ees with the first i edges 8, Cry e, of T. (vi) We start with this tree T* + e,— e’ instead of T*, we have either T*+e,—e'=T or we can find another optimal spanning tree which contains first j edges €,, €,5 «+--+ 0% of T for some j > i. 5 (ii) Proceeding likewise, as G is finite, at a stage we get an optimal tree which contains all the edges of T with T* and Tisomorphic. | uF Thus T is an optimal spanning tree. : MI Here we have another algorithm to find minimum spanning tree of the graph called prim’s algorithm. This algorithm is vertex based one. Prim’s Algorithm Let G = (V, E) and [V(G)| =” Step 1: Lable the n vertices of the graph ¥,, Vz» +9 Ya Step 2: Tabulate the weights of the edges of G in n x n table. Step:3: Set the weights of non existent edge as ©. Step 4: Start with vertex v, and connect it to its nearest neighbour which has the smallest entry in the row ! of the table say v,- Step 5: Now consider ¥,¥, 25 @ subgraph and connect this subgraph to its Closest neighbour (has the ‘smallest entry) among the Ist and ith rows. Say it as Veo Step 6: Next regard ¥) Yr and v, as one subgraph and repeat the step 4 tl all the n vertices have been connected by n— 1 edges. WIL fe Ns 6.76 Discrete Mathematics Vertex cut Connectivity A set of vertices V' © V(G) of a connected graph is said to be vertex cut if G-—V' is disconnected. A k-vertex cut is a vertex cut with k vertices. The vertex connectivity k(G) of the graph G is the minimum k for which G has a k-vertex cut. Then G is said to be k-vertex connected graph. vs % For example: Vs Vs Figure 6.67 Now (i) G— {v,, vy v,} is disconnected {v,, v,.v,} is a vertex cut of G _ (ii) G— {y,, v,} is disconnected, therefore {v, v,} also vertex cut of G. But {v,, v,} is the minimum vertex cut in which G — {v,, v,} is disconnected. 1. G is 2-vertex connected graph ie., K(G) = 2. Edge cut The set of edges E’ "CE of a connected graph G is said to be k-edge cut if G-E ’ is disconnected. The edge connectivity k'(G) of the graph G is the minimum k for which G has a K-edge cut. vy 3 & v% G G-{e, e, e,) y, ¢ 1 Ww ie Vy e je, &| "1 é, ° y, ee Graphs _6.77 Therefore, {2}, € €,} is an edge cut, but both {e,, e,} and {2 e,} are “minimal edge cuts. ‘Therefore G is 2-edge connected i.e., kG) = 2. Example: Consider the graph. Figure 6.69 Here k(G) = 1, K(G)=2 Since G — v is disconnected, and G - {e,, ¢,} is disconnected. Remark: 1. A cut vertex and cut edge is always the minimum vertex cut and minimum edge cut respectively. -2. Ifa graph G has.a cut vertex, then kKG)=1 3. Ifa graph G has an cut edge, then k’ (G) =1 4. If a graph is disconnected, then k (G) = k(G)=0 5. For K,, K(K,) =”- 1 and k (K,) does not exists. Theorem 27: For any graph G, KG) < k(G) < &G) ie., (vertex connectivity < edge connectivity < minimum degree) Proof: If G is trivial, then = 0 <8. Otherwise, let v be a vertex with minimum degree in G. ie., deg(v) = 5(G). Then the removal of all 5 edges incident with v produces a disconnected graph in which {v} is a component. We have #(v) < deg (v) = 8(G). We prove k(G) < k'(G) by induction on KG). ‘ If k(G)=0, then G is either trivial or disconnected. In either case K(G)=0. Thus if (G) = 0, then K(G) = #(G). Assume that, k(G) < K(G) is tree for all graphs with edge connectivity less than 7. 5 Let G be a graph with edge connectivity 7. Let S be a n-edge cut of G. ple an edge e€S and let H= G —e. Then edge connectivity of H= Ge is eal Therefore by induction hypothesis K(H) = K(H)=n-1. IfH contains a complete graph asa spanning subgraph, then G also contains Spanning complete graph and so k(G) = A(H) .Figure 6.70 Here k= 1, =2,8=3, Since, minimum vertex cut = {v} Minimum edge cut = {e,, e,} Minimum degree =3, .

You might also like