Discrete Mathematics: Unit III: Graphs

Representing Graphs and Graph Isomorphism

Graphs - Discrete Mathematics

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.

Representing Graphs and Graph Isomorphism 

Definition: 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.

Definition: Adjacency matrix

Let G (V, E) be a simple graph with n. Vertices ordered from V1 to Vn, then the adjacency matrix A = [aij]n˟n of G is an n˟nsymmetric matrix defined by the elements.

Properties of adjacency matrix

1. An adjacency matrix completely defines a simple graph

2. The adjacency matrix is symmetric

3. Any element of the adjacency matrix is either 0 or 1, therefore it is also called as, bit matrix or boolean matrix.

4. The ith row in the adjacency matrix is determined by the edges which originate in the node Vi.

5. If the graph G is simple, the degree of the vertex V; equals the number of 1's in the ith row (or ith column) of AG.

6. Given an n˟n symmetric boolean matrix A, we can find a simple graph G s.t A is the adjacency matrix of G.

7. G is null ↔ A(G) is the zero matrix of order n.

Example 1. Use an adjacency list to represent the given graph.

Example 2. Represent the following graph with an adjacency matrix.

Example 3. Write the adjacency matrix of K4

Solution: K4 graph is

Example 4. Write the adjacency matrix of K2,3

Solution: K2,3 graph is

Example 5. Write the adjacency matrix of C4.

Solution : C4 graph is

Example 6. Write the adjaency matrix of W4.

Solution: W4 graph is

Example 7. Write the adjacency matrix of Q3

Solution: The Q3 graph is

Example 8. Draw a graph of the given adjacency matrix.

Example 9. Represent the given graph using an adjacency matrix.

Example 10. Find the adjacency matrix of the given directed multigraph.

Example 11. Use an adjacency matrix to represent the pseudograph shown in figure.

Solution: The adjacency matrix using the ordering of vertices a, b, c, d is

Definition: Incidence matrix

Let G be a graph with n vertices, Let V = {V1, V2, ... Vn} and E = (e1, e2,...em). Define n x m matrix

IG = [mij]n˟m where

            

Note :

1. The incidence matrix contains only 0 and 1.

2. The number of 1's in each row equals to the degree of the corresponding vertex.

3. A row with all zeros represents an isolated vertex.

4. Every edge is incident on exactly two vertices, each column of the Incidence matrix has exactly two ones except the loop.

5. The parallel edges in a graph produce idential columns in its incidence matrix.

6. Permutation of any two rows or columns in an incidence matrix simply corresponds to relabeling the vertices and the edges of the same graph.

Example 12. Represent pseudograph shown in figure using an incidence matrix.

Solution: The incidence matrix for this graph is

Example 13. What is the sum of the entries in a row of the incidence matrix for an undirected graph?

Solution: Sum is 2 if e is not a loop, 1 if e is a loop.

Example 14. Find the incidence matrices for the graphs (a) Kn    (b) Cn     (c) Wn

Solution:

Where B is the answer to (b)

Definition: Isomorphic Graphs

The simple graphs G1 = (V1, E1) and G2 = (V2, E2) are isomorphic if there is a one-to-one and onto function f from V1 to V2 with the property that a and b are adjacent in G1 if and only if  f(a) and f(b) are adjacent in G2, for all a and b in V1. Such a function f is called an isomorphism.

In otherwords

Two graphs G and G' are isomorphic if there is a function f: V (G) → V (G') from the vertices of G to the vertices of G' such that

(i). f is one-to-one

(ii) f is onto and

(iii) For each pair of vertices u and v of G

[u, v] ϵ E (G) ↔ [f(u),ƒ(v)] ϵ E (G')

Any function f with the above three properties is called an isomorphism from G to G'.

Example 15. Explain why the two graphs given below are not isomorphic.

Solution: In the graph (a), no vertices of degree two are adjacent while in the graph (b) vertices of degree two are adjacent. Because isomorphism preserves adjacency of vertices, the graphs are not isomorphic.

Example 16. Show that the graphs G = (V, E) and H = (W, F), shown in figure are isomorphic.

Solution: The function f with f (u1) = 1, ƒ (u2) = 4, f (u3) = 3, and  f(u4) = 2 is a one-to-one corresponding between V and W.

Here the correspondence preserves adjacency, note that adjacent vertices in G are u1 and u2, u1 and uз, u2 and u4, and u3 and u4 and each of the pairs f (u1) = 1 and f(u2) = 4. f (u1) = 1 and f (u3) = 3, f(u2) = 4 and ƒ (u4) = 2, and ƒ (u3) = 3 and ƒ (u4) = 2 are adjacent in H.

Example 17. Show that the two graphs shown in figure are isomorphic.

Solution: Here, V(G1) = {1, 2, 3, 4}, V (G2) = {a, b, c, d},

E (G1) = {{1, 2}, {2, 3}, {3, 4}} and E (G2) = {{a, b}}, {b, d}, {d, c}

Define f: V(G1) → V (G2) as

f (1) = a, f(2) = b, f (3) = d and ƒ (4) = c

f is clearly one-one and onto, hence an isomorphism.

{1, 2} ϵ E (G1) and {f (1), f (2)} = {a, b} ϵ E (G2)

{2, 3} ϵ E (G1) and {ƒ(2), f (3)} = {b, d} ϵ E (G2)

{3, 4} ϵ E (G1) and {f (3), f (4)} = {d, c} ϵ E (G2)

{1, 3} € E (G1) and {f(1), f (3)} = {a, d} € E (G2)

{1, 4} € E (G1) and {f(1), f (4)} = {a, c} € E (G2)

{2, 4} € E (G1) and {f(2), f (4)} = {b, c} € E (G2)

Hence ƒ preserves adjacency as well as non-adjacency of the vertices. Therefore G1 and G2 are isomorphic.

Example 18. Prove that the graphs G and G given below are isomorphic

Solution: The two graphs have the same number of vertices same number of edges and same degree sequence consider the function f.

f(u1) V1, f (u2) = v3, f (u3) = V4, ƒ (u4) = V2, f (u5) = v5

then the adjacency matrices of the two graphs corresponding to f are

G and Ğ are isomorphic to each other.

Example 19. Show that the Digraphs are isomorphic.

Solution: G and   are having 5 vertices and 8 edges. Consider indegree and out degree of the vertices if G and .

Now

f(v1) = u5, f (v2) = u1, f (v3) = u2

f(v4)=u3, f (v5) = u4

Clearly f is one to one and onto.

AG = AĞ  under this mapping f

G and Ğ are isomorphic.

Example 20. Prove that any 2 simple connected graphs with n vertices all of degree 2 are isomorphic.

Solution: We know that total degree of a graph is given by

Σni=1 d(Vi)=2|E|

then     |V| = number of vertices n

|E| = number of edges

Further the degree of every vertex is 2.

Therefore        Σni=1 2 = 2|E|

2 ((n) − 1 + 1) = 2 |E|

n = |E|

number of edges = number of vertices. Therefore the graphs are cycle graphs Hence they are isomorphic.

Example 21. Can a simple graph with 7 vertices be isomorphic to its complement?

Solution: A graph with 7 vertices can have a maximum number of edges.

= 7(7-1) / 2 = 7×6 / 2 = 21 = 21 edges

21 edges cannot be split into 2 equal integers. Therefore, G and  cannot equal number of edges. Hence a graph with 7 vertices cannot be isomorphic to its complement.

Example 22. Let G be a simple graph all of whose vertices have degree 3 and |E| = 2 |V| - 3. What can be said about G?

Solution :

Σ|v|i=1 d(Vi)=2|E|

3 (|V| - 1+1) = 2|E|

3 |V| = 2 |E|

3|V| = 2(2 |V| − 3)

= 3|V| = 4|V| - 6

|V| = 6

Number of vertices in G = 6 It can be concluded that G is isomorphic to K3,3

Example 23. Show that isomorphism of simple graphs is an equivalence relation.

Solution:

(i) Reflexive: G is isomorphic to itself by the identity function, so isomorphism is reflexive.

(ii) Symmetric: Suppose that G is isomorphic to H. Then there exists a one-to-one correspondence ƒ from G to H that preserves adjacency and nonadjacency. From this f-1 is a one-to-one correspondence from H to G that preserve adjacency and non adjacency.

Hence, isomorphism is symmetric.

(iii) Transitive: If G is isomorphic to H and H is isomorphic to K, then there are one-to-one correspondences ƒ and g from G to H and from H to K that preserve adjacency and non adjacency. It follows that gof is a one-to-one correspondence from G to K that preserves adjacency and non adjdacency. Hence, isomorphism is transitive.

EXERCISES 3.3

1. Draw a graph with the given adjacency matrix.

2. Represent the given graph using an adjacency matrix.

3. Draw an undirected graph represented by the given adjacency matrix.

4. Find the adjacency matrix of the given directed multigraph.

5. Draw the graph represented by the given adjacency matrix.

6. Is every zero-one square matrix that is symmetric and has zeros on the diagonal the adjacency matrix of a simple graph?

[Ans. Yes]

7. Describe the row and column of an adjacency matrix of a graph corresponding to an isolated vertiex.

[Ans. Zeros]

8. Show that the vertices of a bipartite graph with two or more vertices can be ordered so that its adjacency matrix has the form

9. Find a self-complementary simple graph with five vertices.

[Ans. C5]

10. For which integers n is Cn self-complementary?

[Ans. for n = 5 only]

11. How many non isomorphic simple graphs are there with five vertices and three edges ?

[Ans. 4]

12. Are the simple graphs with the following adjacency matrices isomorphic?

13. Determine whether the given pair of directed graphs are isomorphic.

14. Find a pair of non isomorphic graphs with the same degree sequence such that one graph is bipartite, but the other graph is not bipartite.

[Ans. Many answers are possible for example C6 and C3UC3]

15. What is the product of the incidence matrix and its transpose for an undirected graph ?

[Ans. The product is [aij] where aij is the number of edges from vi to vj when i≠j and aii is the number of edges incident to v1 ]

Discrete Mathematics: Unit III: Graphs : Tag: : Graphs - Discrete Mathematics - Representing Graphs and Graph Isomorphism