You are on page 1of 10

Topic

12

Graph Representation and Isomorphism

LEARNING OUTCOMES
By the end of this topic, you should be able to: 1. 2. 3. Represent graphs by using matrices; Explain the concept of isomorphism; and Able to determine whether two graphs are isomorphic.

X INTRODUCTION
There are several ways to represent graphs. We have seen the graphical representation of graphs. In this topic, we are going to consider another representation of graphs, that is by using matrices. This representation will make it easier to analyse graphs by using computers. Sometimes, two graphs may have different graphical representation, but in actual fact they are representing the same graph. These two graphs are said to be isomorphic. Determining whether two graphs are isomorphic is an important problem in graph theory.

148 X TOPIC 12 GRAPH REPRESENTATION AND ISOMORPHISM

12.1

GRAPH REPRESENTATION
SELF-CHECK 12.1

What is the information that you need to gather to represent them in graph? What are the steps involve?

To make it easier for us to analyse a graph, we need a more formal representation that is by using matrices. There are two types of matrices that can be used to represent graphs.

Figure 12.1: Two types of graph representation

12.1.1
x x x

Adjacency Matrix

To obtain the adjacency matrix of this graph, we need to: Firstly, select an ordering of the vertices, say a, b, c, d, e. Next, we need to label the rows and columns of a matrix with the ordered vertices. The entry in this matrix in row i, column j, i z j, is the number of edges incident on i and j. If i = j, the entry is twice the number of loops incident on i.

TOPIC 12 GRAPH REPRESENTATION AND ISOMORPHISM W 149

Example 12.1a Consider the graph as illustrated in figure 12.2.

The adjacency matrix of this graph is

0 d1 d2 d3 d4

d1 0 1 0 0

d2 1 0 1 0 1

d3 0 1 2 0 1

d4 0 0 0 0 2

d5 1 1 1 2 0

d5 1

Notice that we can obtain the degree of a vertex v in a graph G by summing row v or column v in Gs adjacency matrix. Example 12.1b The adjacency matrix of the simple graph of figure 12.3 is 0 w1 w2 w3 w4 w5 w1 0 1 0 1 w2 1 0 1 0 1 w3 0 1 0 1 1 w4 1 0 1 0 0 w5 0 1 1 0 0

150 X TOPIC 12 GRAPH REPRESENTATION AND ISOMORPHISM

Figure 12.3: Example 12.1b

We will show that if A is the adjacency matrix of a simple graph G, the powers of A, A, A2, A3, count the number of paths various length. More precisely, if the vertices of G are labeled 1, 2 the ijth entry in the matrix An is equal to the number of paths from i to j of length n. Example 12.1c Suppose that we square the matrix A in Example 12.1b to obtain 0 w1 w2 0 3 1 2 1 w3 2 1 3 0 1 w4 0 2 0 2 1 w5 1 1 1 1 2

0 1 A2 = 0 1 0

w1 2 w2 0 = 1 0 1 1 0 1 0 1 1 w3 2 0 1 0 0 1 0 1 0 0 w4 0 1 1 0 0 0 1 1 0 0 w5 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 1

Consider the entry for row 1, column 3 in A2. Since the value of the entry is 2, we can conclude that there are two paths of length 2 from w1 to w3. The two paths are (w1, w2, w3) (w1, w4, w3) If G is a simple graph, the entries on the main diagonal of A2 give the degrees of the vertices. Consider, for example, vertex w3. The degree of w3 is 3 since w3 is incident on the three edges (w3, w2), (w3, and w4), (w3, w5).

TOPIC 12 GRAPH REPRESENTATION AND ISOMORPHISM W 151

12.1.2

Incidence Matrix

The adjacency matrix is not a very efficient way to represent a graph. Since the matrix is symmetric about the main diagonal, so the information, except that on the main diagonal, appears twice. Another useful matrix representation of a graph is known as the incident matrix. To obtain the incident of the graph, First, we have to label the rows with the vertices and the column with the edges (in some arbitrary order). The entry for row v and the column e is 1 if e is incident on v and 0 otherwise.

Example 12.1d

Figure 12.4: Example 12.1d

The incident matrix for the graph in Example 12.1a is e1 e2 e3 e4 d1 1 d2 1 d3 0 d4 0 d5 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 1 e5 e6 e7 0 1 0 0 1 1 0 0 0 1 0 0 0 1 1 e8 0 0 0 1 1

152 X TOPIC 12 GRAPH REPRESENTATION AND ISOMORPHISM

Example 12.1e

Figure 12.5: Example 12.1e

The incident of the graph is shown in the figure below. is

d1 e1 w1 1 w 0 A= 2 w3 0 w4 1 w5 0

e2
1 0 0 1 0

e3
1 1 0 0 0

e4
0 1 0 1 0

e5
0 1 0 0 1

e6
0 0 1 0 1

e7
0 1 0 0 0

From the incidence matrix, we get the following information about a graph. A column that has only one entry, such as e7 in Example 12.1e is representing a loop. The sum of a row gives the degree of the vertex identified with that row. For example, the sum of row w2 in Example 12.1e is 4. This implies that deg (w2) = 4.

ACTIVITY 12.1
1. Write the adjacency matrix of each of the graphs below:

TOPIC 12 GRAPH REPRESENTATION AND ISOMORPHISM W 153

2.

Draw the graph represented by each of the adjacency matrices: (a) a a b c d e a 2 0 0 1 0 b0 0 1 0 1 c 0 1 2 1 1 d1 0 1 0 0 e 0 1 1 0 0 (b)
a a b c d e a 0 1 0 0 0 b1 0 0 0 0 c 0 0 0 1 1 d0 0 1 0 1 e 0 0 1 1 2

12.2

ISOMORPHISM

Definition 12.2a: Graphs G1 and G2 are isomorphic if there is a one to one, onto functions f from the vertices of G1 to the vertices of G2 and a one to one, onto function g from the edges of G1 to the edges of G2, sp that an edge e is incident on v and w in G1 if and only if the edge g(e) is incident on f(v) and f(w) in G2. The pair of functions f and g is called an isomorphic of G1 onto G2. Example 12.2a An isomorphic for the graphs G1 and G2 in figure 12.6 is defined by

154 X TOPIC 12 GRAPH REPRESENTATION AND ISOMORPHISM

Figure 12.6: Example 12.2a

f(a) = B, f(b) = D, f(c) = A, f(d) = C, f(e) = E, g(x1) = y1 , g(x2) = y2 , g(x3) = y3 , g(x4) = y4 , g(x5) = y5 One helpful way to show that two graphs are isomorphic is by using the adjacency matrices. To show two graphs G1 and G2 are isomorphic, we can show that G1 and G2 have the same adjacency matrix. Example 12.2b Consider the two graphs in Example 12.2a. The adjacency matrix for G1 is a a b c d e a 0 1 0 0 1 b1 0 1 0 0 c 0 1 0 1 0 d0 0 1 0 1 e 1 0 0 1 0 The adjacency matrix for G2 is a A B C D E A0 B 0 C 1 D1 E 0

0 0 0 1 1

1 0 0 0 1

1 1 0 0 0

0 1 1 0 0

TOPIC 12 GRAPH REPRESENTATION AND ISOMORPHISM W 155

By rearranging the matrix for G2 using row and column operations, we will obtain a matrix that is similar to the matrix for G1. Hence, we can conclude that they are isomorphic. It is often difficult to determine whether two graphs are isomorphic. However, we can often show that two simple graphs are not isomorphic by showing that they do not share an invariant. Definition 12.2b: A property P is an invariant if whenever G1 and G2 are isomorphic graphs: if G1 has property P, G2 also has property P.

Examples of invariants are: 1. 2. 3. 4. Has n edges Has n vertices of degree k Is connected Has n simple cycle of length k

Example 12.2c The graph G1 and G2 in figure 12.7 are not isomorphic, since G1 has seven edges and G2 has six edges.

Figure 12.7: Example 12.2c

The two graphs above are not isomorphic, since G1 has four vertices with degree 3 while G2 has only two edges with degree 3.

156 X TOPIC 12 GRAPH REPRESENTATION AND ISOMORPHISM

Example 12.2d

ACTIVITY 12.2
Determine whether the graph G1 and G2 are isomorphic. If the graphs are isomorphic, find functions f and g for the above definition; otherwise, give an invariant that the graphs do no share.

The website has a 44 pages of PDF file with detail explanations of different types of graph including isomorphism. You can download, save and read it offline anytime. URL: http://www.cise.ufl.edu/class/cot3100sp03/notes/Module-19- Graphs.pdf

You might also like