Download as pdf
Download as pdf
You are on page 1of 9
u— > y—57 att Representation of Graphs fe : . Although a diagrammatic representation wisi only possible when the number of vel sntation are given below, Matrix Representation, of a graph is very convenient for a visual sity, tlices and edges is reasonably small. Two types ©! The matrix are commonly used to represent graphs for computer ing, The advantages of, Tepresenting the graph in matrix form lies on the fact that many results {matrix algebra can be readily applied to Study the structural properties of graphs from an algebraic point of view. There are number of matric which one can sdacency matrix and the incidence matrix, Adjacency Matrix (q) Representation of Undirected Graph Theadjacency matrix ofan undirected gray A=[a,] whose elements are given by associate with any graph. We shall discuss ph G withn vertices andno parallel edges isan n by n matrix a, = I, if there is an edge between ith and [jth vertices, and =0, if there is no edge between them. Observations () Ais symmetric i.e. ay (ii) The entries along the principal diagonal of A all 0's if and only if the A self loop at the vertex corresponds to a=. ii) If the graph is simple (no self loop, no parallel edges), unber of 1’s in the corresponding row or column of A. =a, for all iandj, graph has no self the degree of vertex equals the (>) The (i,j) entry of 4” is the number of paths of length ( r ‘no. of occurence of edges) m from "EEK Vt, vertex v,, © IGbea graph with n vertices v,, V,... --¥, and let A denote th Gwith Tespect to this listing of the vertices. Let B be the matrix, B=AtA +434... +A (n> 1) va —. adjacency matrix oo” NOTE tay 560 ATEXTHOOK OF DIBC "hon G is. connotea apt i haw Ho 2ove onion Nhis ronutt ean tye used w chook the eonnectodnons oF peaph by Wil i Adaceney ean alse be ued to roprevent undirected jeuph with loops and iy AU the vertex vy, must have the elo Mt Ate Present the aliaceney matin is Ho Fonper A Zor» ae wNALTA, wie the (1 /) he iy My equ le Humber of edges that are associated between v, and vy, All unditected praphs, including yt nd pscudographs, have syrmettie adjacency matrices (d) Representation of Di ected Graph The adjacen Htiple etc, equal 10 F in the adljaceney matrix. Why matriy of a dlageaph 2, with 1 vertices fy the mately A aye itare ti. ) y= Liao (vy) i * Hothervixe, Maiti, Observations (Ais not neces fan ede from v, to v, metric, since there may not be an edge from v0 (i) The sum of any column off of A is equal to the number of ares di (iti) The sum of entries in row (out degree of vertex ¥) fl toward, ‘is equal to the numberof ares directed away fom eye (iv) The (4, /) entry of a is equal to the number of path of length m from vertex ¥10 Veron (*) The diagonal elements of A, "show that out degree ofthe vertices. The dona OL AT. A shows the in degree of the vertices, ies The adjacency matrices can also be used to represent directed multigraphs. Again such matrices {re not zero ~ one matrices when there are multiple edes in the same direction connecting og vertices. In the adjacency matrix for a directed multigraph, a, equals the number of edges that a associated t0 (1,1). Example 38 : Use adjaceney matrix to represent the graphs shown in Fig, 14,50. | ‘ Yp vy Vy DN] 4 PN | My Ma Vy ‘a M4 Vy | (a) (b) Cy Fig. 14.50 4 i verti Solution. We order the vertices in Fig 14.51 (a) as v,, v,, vy and v4. Since there are four ve ‘ “The requ » the adjacency matrix representing the graph will be a square matrix of order four. The re adjacency matrix is Re Ost 1 ‘ poe 0 | 0 ie 2 it ot et cing ‘We order the vertices in Fig, 14.51 (6) as v, ax represet and vy. The adjacency matrix repr graph with loop and multiple edges is given by —~! 569 1 3 2 the order of the vertices in Fig 185 digraph is given by "8 14.51 (as a ssample 39 : Draw the undirected graph Tepresented by adjacency matrix 4 given by to 0 Lo 7 0 att oo | 0 Oo 1 6 1 O70 0 1 1 Solution. Since the given matrix is a 5 qQuare of order 5, the graph G has five vertices v.13 .V5, jalv, Draw an edge from v;to v, where 4,= 1. The required graph is drawn in Fig, 14.52. vy Ne \e Ys % Fig. 14.51 Example 40: Draw the digraph G corresponding to adjacency matrix, 0-0 1 1 0 0 15 0 a 4 fo 4 11 10 Solution, Since the given matrix is square matrix of order four, the graph G has 4 vertices “sand v,, Draw an edge from y, o v, where a, = 1. The required graph is shown in Fig, 14.53, v; a . My o Fig. 14.52 =” A TEXTBOOK OF DISCRETE Mary, a (EM, Ney 570 graph G corresponding 10 adjacency mat, Example 41: Draw the undirected ix is square matrix of order 4, G has § ix, Draw m edges from v,10 ¥, where gt his shown in Fig.14.53. yen given adjacency matrit x is not a zero-one mal Solution. Since the vy, =n, The required grap! 1 ¥yy ¥y and vy. The matri draw n loop at v, where ay yy Ve Ye V3 Fig. 14.53 Example 42. Consider the graph shown in Fig. 14.55. Find the number of walks of length, from v, tov, and also check the connectedness of he graph. he y Me Ne Vy Fig. 14.54 Solution. The adjacency matrix of the graph is Mov Ms MA yfo 1 1.0 1001 1001 yLo 1 1 0 0 1 1 o]fo 1 1 07 f2 0 02 _ PG o oo ee 100 1{{1 001} jo22° : 011 offo 1 1 of [2 0 02 Similarly, using matrix multiplication, we get 0440 8008 4004 0880 B= = 400 4|4"Jo 8 8 0 0440 80 0 8 sed ry Now the number of walks of length 3 from v3 (0 v= the element in the (2,4) th io oe yo The four different edj = -y,,and e Se A ’ 7 ige sequence are v,—V —V,—Vg.¥)—V, Vp —Vyp¥ Vg V NE? Again B=A+A2+A2+A4 HEORY-! : — ee 0 ie 2002 fo4 40) [89°8 ~ 0 a-[) 221] Jo 22 ol [soo aioe | ; i\*Jo 22 of*|4 oo af jo 8 8° TT oll cot) log 4 Oe 10 5 5 10 or p-|> 10 0 5 . 5 10 10 5 Which contains no zero element. 1 5 5 10 sjence the graph is a connected graph, | | that one can use th . | : | re eae poeoeen? matrix to check whether or not the given graphs Gand G’ ion aa Z phic if and only if their vertices can. be labeled in such a way | gothe corresponding adjacency matrices are equal. | Theorem we Two graphs G, and G, are isomompic if and only ifthe adjacency math | gone is abtained from that of the other by interchanging rows and also columns in the same way. Example 43, Show that the graphs G and G' are isomorphic. Solution. Consider the mapf:G>d, define as f(a) = 4, f(b) = a fora fide, and jie)=e,. The adjacency matrix of G for the ordering a, b, ¢, d and ¢ is abe de aio 1 0 10 pl1 o 1 07 ageaclo 1 ott dj1oi1ot ela 11 1 0 The adjacency matrix of G’ for the ordering da’, b,c’ and e’is ao. by ce afo 10 10 rl 0 1.0)! aGy=b|o 1° i glia to! elo11 }° ie A(@=AG) © Gand G’ are isomorphic. TEXTBOOK OF DISCRETE Hy, Incidence Matrix (a) Representation of Undirected Graph Consider a undirected graph G = (V, £) which has 1 vertices and m edge, incidence matrix 1(G) = [by], is then nx m matrix, where b, = 1 when edge gis incident with v, =0 otherwise 572 a fy, taba Observations (Each column of B comprises exactly two unit entries. (ii) A row with all 0 entries corresponds to an isolated vertex. (iif) Arow witha single unit entry corresponds to a pendant vertex. (is) The numberof unit entries in row fof B is equal to the degree ofthe correspon (v) The permutation of any two rows (any two columns) of 1(G) corresponds ‘oar of the vertices (edges) of G. (vi) ‘Two graphs are isomorphic ifand only if their corresponding incidence matic, only by a permutation of rows and columns. 3 (vif) I€G is connected with n vertices then the rank of 1(G) is n— 1. Incidence matrices ean also be used to represent multiple edges and loops. Mulipe are represented inthe incidence matrix using columns with identical entries. Since thee eg. incident withthe same pair of vertices. Loops are represented using a column with exaeth gg. equal to /, corresponding to the vertex that is incident with this loop. (b) Representation of Directed Graph sence matrix 1D)= [6] of egraph D with nverices and m edges them in which, 2 Ta, a) by 1 if are j is directed away from a vertex v, = -lifare is directed towards vertex v, O otherwise. Example 44 : Find the incidence matrix to represent the graph shown in Fig. 145. “ e Vp vs i os : NJ j : N ; “Ne Me 7 : © Fig. 14.55 ire Solution. The incidence matrix of Fig.(a) is obtained by entering for row v and columé® ife is incident on v and 0 otherwise. The incidence matrix is, % ee &4 es wfl oor) AG)=v,}1 1000 wyJO 1101 wl0 01 10 i — incidence matrix of i the qe" Sigtaph of Fig. 573 Bb) ig ST2 1 KDya\~! 1 0 1 0 psample 45. Draw the graph, hose inden oy Ce matrix is 004 loo 00 1 1 04 ; ° 0 : 1 : lo 0 0 1 1 0 0 0 o-o solution. Since the given m, ‘atrix has geesand 6 edges. We re-write 1 5 tows a he incidease a 6 columns, its corresponding graph has 5 ix as follows: %& & & es & iO 0 0 i Yall 0 1.0 0 0 wll 00004 v0 1 1 4 1.0 wl0 00100 Since first column contains two 1 placed at 2nd and 3rd row, vertices v, and v, are connected 'y¢, Similarly, the vertices v, and v, are connected by ey, and the vertices v, and v, are connected 4yeand so on. Therefore, the graph of the given incidence matrix is vy ey Ye : below: Example 46, Draw the graph whose incidence matr= is given below ple 46. Draw Oh Oe alae +11 0 0 0 oy OU y G00 pace 0 ae A TEXTBOOK OF DISCRETE MAT Hp, a Mi 574 S a and 5 columns, its corresponding Erap, re rows 3 given matrix has 6 1, iris a digraph. We rewrite the i ° incyy 4 the matrix has the element Solution. Since the vertices and 5 edges. Since matrix as follows: Gees pone ale! 2 wi-1 1 9 9 ® vy o 0 o 0 0 ahi @ 0101 fo -1 ° o 0 mio Oo -! | 2 since first column contains “1 placed at 2nd row, and | placed at Ath row, the edge e, is, from v, tov The edge €2 has no direction and its connected by v2 and Vs, the edge e, has 4 from ¥; to v4, the edge from ¥, 10 the ed8e es from v, tov, but the Vertex v8 n0t conncs. ery wetex. Hence vis isolated veriex and the graph is not connected. 1 y yence, the graph of she incidence matte: is % ve “5 ef yes Xe O G Ys Ye Me Theorem 14.19. Two graphs G, and G; are isomorphic if and only if the incidence mati «! ae is obtained from that of the other by permutation of rows/columns of the matrix. ‘Example 47. Using incidence matrix find whether the two given graphs G, and G, are isomorph Yo e K 7 a * 5 G we we, a, a | 2; & s Gy, mu MMe ve G, 2 Solution. The incidence matrices of the two graphs are a, a, 43 ay Gs 4 3 ee oo00 ufl 0 0 oo Toe m}1 10 0 0 110 Ofand = 1(G,)=%}0 1:1 01 oat u}0 011 0 C aa u|0 0 0 1 0 oe 10 00 01 Now, if /(G,) can be obtai : 7] Gare isomorphic. can be obtained from / (G,) by interchanging rows and columns. then 6 | nn ie We see Ist three columns ot and f1(G, we imerchange Sth row and 6th tne. - (G,) are same. To make the fourth co! apd get 8 mais Be Wesee first four columns of {(G) and B are same. The only fifth column of B is not same as sol (G,). ga, we conclude J (G,) can not be obtained from !(G)) by interchanging rows and columns. axethe two graphs G. and Gy are not isomorphic.

You might also like