0% found this document useful (0 votes)
187 views15 pages

Unit 12 Representations of Graphs: Structure

The document provides information about different matrix representations of graphs: - Adjacency matrices represent connections between vertices with 1s and 0s - Incidence matrices represent connections between vertices and edges with 1s and 0s - Circuit matrices represent the edges that are part of circuits/loops in the graph with 1s and 0s These matrix representations allow analyzing graph structures and properties algebraically.

Uploaded by

John Arthur
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views15 pages

Unit 12 Representations of Graphs: Structure

The document provides information about different matrix representations of graphs: - Adjacency matrices represent connections between vertices with 1s and 0s - Incidence matrices represent connections between vertices and edges with 1s and 0s - Circuit matrices represent the edges that are part of circuits/loops in the graph with 1s and 0s These matrix representations allow analyzing graph structures and properties algebraically.

Uploaded by

John Arthur
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Fundamentals of Algorithms

Unit 12

Unit 12

Representations of Graphs

Structure 12.1 Introduction Objectives 12.2 Adjacency and Incidence Matrix 12.3 Circuit Matrix 12.4 Path Matrix 12.5 Summary 12.6 Terminal Questions 12.7 Answers

12.1 Introduction
Even though, a pictorial representation of a graph is very convenient for a visual study, other representations are better for computer processing and constructing graphical algorithms. Many results of matrix algebra can be applied to study the structural properties of graphs. In this unit, we will study the adjacency, incidence, circuit, and path matrices with illustrations. We will observe properties of each of these matrices. We will also discuss correspondence between some graph theoretic operations (properties) and matrix properties. Objectives After studying this unit, you should be able to: write the matrix representations of a given graph give different matrix representations of graphs explain the algebraic properties of matrices of graphs apply the properties to switching networks

12.2 Adjacency and Incidence Matrix


Definition: Let G be a graph with n vertices v1, v2, , vn and no self-loops and no parallel edges. We define an n follows: aij = 1 if vi is adjacent to vj; =0 other wise. n adjacency matrix A = [ aij ]n n, as

Sikkim Manipal University

Page No. 216

Fundamentals of Algorithms

Unit 12

v3 e v2 f g

a v4 c

v6

v1

d
Fig. 12.1

v5

v1 v1 0 v2 1 v3 0 v4 0 v5 1 v6 0

v2 1 0 1 1 1 0

v3 v4 v5 v6 0 1 0 0 0 0 0 1 0 0 1 1 1 1 0 1 0 0 0 0 0 1 0 0 6x6

Matrix

Observations: i) The entries along the principal diagonal of the adjacency matrix are all 0s (since it has no self loops). ii) The degree of a vertex equals the number of 1s in the corresponding row (or a column). iii) Given any square, symmetric, binary matrix X of order n, one can always construct a graph G of n vertices (and no parallel edges) such that X is the adjacency matrix of G. Definition: Let G be a graph with n vertices, e edges and no self-loops. We define an n e matrix I = [ aij ]n e, whose n rows correspond to the n vertices, and the e columns correspond to the e edges, as follows: aij = 1 if jth edge ej is incident on ith vertex vi; = 0 other wise.
Sikkim Manipal University Page No. 217

Fundamentals of Algorithms

Unit 12

This matrix I is said to be the vertex-edge incidence matrix (or) simply incidence matrix. This matrix I (for the graph G) may be denoted as I(G). Example Consider the graph G given in Fig. 12.2

v3 e v2 f v1 d
Fig. 12.2

a v4 g c

v6 b

v5

The incidence matrix I(G) is an n e = 6 8 matrix as given below:


a v1 0 v2 0 I(G) = v 3 0 v4 1 v5 0 v6 1 b 0 0 0 1 0 1 c 0 0 0 1 1 0 d 1 0 0 0 1 0 e 0 1 0 1 0 0 f 1 1 0 0 0 0 g 0 1 0 0 1 0 h 0 1 1 0 0 0 6 x8

Matrix

A matrix whose entries are only either 0 or 1, is called a binary matrix (or) (0, 1)-matrix. We can treat 0 and 1 as two elements from GF(2), the Galois field modulo 2. Observations: The following are some observations on the incidence matrix I of a graph G. i) Each column of I contains exactly two 1s, since every edge is incident on exactly two vertices ii) The number of 1s in each row is equal to the degree of the corresponding vertex. iii) A row contains only 0s, denote an isolated vertex. iv) If two edges a, b are parallel edges (in the graph G), then the corresponding columns (in the incidence matrix I) are identical.
Sikkim Manipal University Page No. 218

Fundamentals of Algorithms

Unit 12

v) If the given graph G is disconnected and consists of two components g1 and g2, then (we can reorder the list of edges and the list of vertices, if necessary) then the incidence matrix I(G) of G can be written in a block-diagonal form as given below: I(G) =

I(g1 ) 0 where, I(g1) and I(g2) are the incidence matrices 0 I(g 2 )

of the components g1 and g2 respectively. (This observation follows from the fact that no edge in g1 is incident on a vertex of g2, and vice versa). [For this, suppose v1, v2, , vm are vertices and e1, e2, , en are edges of G; the subgraphs g1, g2 are two components of G; the vertices v1, v2, , vs are the vertices in g1; the vertices vs+1, ..., vm are vertices in g2; the edges e1, e2, , ek are in g1; the edges ek+1, , en are in g2. If we take vertices and edges in this order, then we get that I(G) =

I(g1 ) 0 ] 0 I(g 2 )

Theorem: Two graphs G1 and G2 are isomorphic if and only if their incidence matrices I(G1) and I(G2) differ only by permutations of rows and columns. Note: If I(G) is an incidence matrix of a connected graph G with n vertices, then the rank of I(G) is n -1. [Note that the entries 0, 1 are elements from 2 or the elements of GF(2)]. Note: i) If we extend the content of the above note for a disconnected graph G with k components, then the rank of I(G) is n - k. This number n - k is called as the rank of the graph G with k components. ii) If we remove any one row from the incidence matrix of a connected graph, then the remaining (n - 1) e submatrix is of rank n - 1 . (That is, the remaining n - 1 vectors are linearly independent). iii) Such (n - 1) e submatrix of I is called a Reduced incidence matrix and it is denoted by Af. The vertex corresponding to the deleted row (to get Af) is called the reference vertex. iv) Any vertex of a connected graph can be made the reference vertex. Note: The reduced incidence matrix of a tree is non-singular.
Sikkim Manipal University Page No. 219

Fundamentals of Algorithms

Unit 12

Example: In a disconnected graph, there exists vertices which cannot be made as the reference vertices. To observe this, consider the graph G given in Fig. 12.3. This graph is a disconnected graph with two components (that is, k = 2), n = 5 vertices and n - 1 = 4 edges.

v1 a

v2 b v3

v5 d

c
Fig. 12.3

v4

Now the incidence matrix is given by


a v1 v2 I(G) = v3 v4 v5 0 1 0 0 1 b 0 1 1 0 0 c 0 0 1 1 0 d 0 0 0 1 1

If =

1 1 0 0 0 1 1 0 0 0 1 1 1 0 0 1

[after removing the 1st row].

If we add the rows, we get 0 (mod 2). So this matrix is a singular matrix (that is, det (If) = 0). Note that this is not a reduced matrix. Definition: Let g be a subgraph of a graph G. Suppose I(g) and I(G) are the incidence matrices of g and G respectively. Then I(g) is called a submatrix of I(G). (So permutation of rows (or) columns are permitted). Note: There is a one-to-one correspondence between each n k submatrix of I(G) and a subgraph of G with k edges, where k being any positive integer less than e, and n being the number of vertices in G. Note: Let I(G) be an incidence matrix of a connected graph G with n vertices.

Sikkim Manipal University

Page No. 220

Fundamentals of Algorithms

Unit 12

An (n - 1) (n - 1) submatrix of I(G) is non singular if and only if the n - 1 edges corresponding to the n - 1 columns of this matrix constitute a spanning tree in G. Definition: Each largest non-separable subgraph is called a block. A separable graph consists of two or more non-separable subgraphs. Example: Consider the graph given in Fig. 12. 4, which contains two blocks.

Block-1

Block-2

Fig. 12.4

Self Assessment Questions 1. The entries along the of the adjacency matrix are all 0s 2. The number of 1s in each row is equal to the degree of the corresponding . 3. The reduced incidence matrix of a tree is . 4. Each largest non-separable subgraph is called a .

12.3 Circuit Matrix


Definition: Let the number of edges in G be e and the number of circuits in G be q. Then, a circuit matrix B =

bij

q e

, (0, 1)-matrix defined as follows:

bij = 1 if the ith circuit includes the jth edge;


Sikkim Manipal University Page No. 221

Fundamentals of Algorithms

Unit 12

= 0 otherwise. The circuit B of G may be denoted by B(G). Example: Consider the graph given in Fig. 12.5

v3 v2 f

a e v4 g c

v6 b

v1

d
Fig. 12.5

v5

For this graph, n = number of vertices = 6 e = number of edges = 8 Here, the graph has 4 different circuits: {a, b}, {c, d, f, e}, {d, f, g}, and {c, e, g}. Therefore, the circuit matrix B(G) is a 4 8, (0, 1)-matrix as given below.
a b 1 0 0 0 c 0 1 0 1 d 0 0 1 1 e 0 1 0 1 f 0 0 1 1 g 0 1 1 0 h 0 0 0 0 4 x8

B(G) =

1 1 2 0 3 0 4 0

Matrix

Observations: i) If a column of B(G) contains all zeros, then the related edge does not belong to any circuit. An edge that does not lie in any circuit is said to be a non-circuit edge. ii) Each row of B(G) corresponds to a circuit. So each row may be called as a circuit vector. iii) If a row contains only one "1", then the related edge is a self-loop. iv) The number of 1s in the ith-row is equal to the number of the edges in the ith circuit.
Sikkim Manipal University Page No. 222

Fundamentals of Algorithms

Unit 12

v) If a graph G is separable (or disconnected) and consists of two blocks (or components) g1 and g2, then the circuit matrix B(G) can be written in a block-diagonal form as B(G) =

B( g1 ) 0 0 B( g 2 )

where, B(g1)

and B(g2) are the circuit matrices of g1 and g2 respectively. Theorem: Let I and B be the incidence matrix and circuit matrix of a (selfloop free) graph whose columns are arranged with the same ordering of edges. Then every row of B is orthogonal to every row of I. That is, IBT = BIT = 0 (mod 2) where IT, BT are the transpose matrices of I and B respectively. Example: Consider the graph given in Fig. 12.6

v3 v2 f

a h e v4 g c

v6 b

v1

d
Fig. 12.6

v5

The incidence matrix I(G) is given by


a v1 0 v2 0 v3 0 v4 1 v5 0 v6 1 b 0 0 0 1 0 1 c 0 0 0 1 1 0 d 1 0 0 0 1 0 e 0 1 0 1 0 0 f 1 1 0 0 0 0 g 0 1 0 0 1 0 h 0 1 1 0 0 0 6 x8

I (G) = I =

Sikkim Manipal University

Page No. 223

Fundamentals of Algorithms

Unit 12

b 1 0 0 0

c 0 1 0 1

d 0 0 1 1

e 0 1 0 1

f 0 0 1 1

g 0 1 1 0

h 0 0 0 0 4 x8

B(G) = B =

c c c c

1 2 3 4

1 0 0 0

The list of all circuits (of the graph) used in getting B(G) is given below: c-1 = {a, b}, c-2 = {c, e, g}, c-3 = {d, f, g}, c-4 = {c, d, f, e}
1 1 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 1 0 1 1 0 0 0 1 1 1 1 0 0

Now, BT (transpose of B) =

8 4

0 0 0 1 0 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0

1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 1 1 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Therefore, IBT =

= 0 (mod

2)

Note: Let G be a connected graph with n vertices, e edges and T a spanning tree. Then, T contains (n - 1) edges. The remaining e - (n - 1) = e - n + 1 edges are chords with respect to T. By joining a chord, we get a fundamental circuit. So, there are e-n+1 fundamental circuits with respect to T.
Sikkim Manipal University Page No. 224

Fundamentals of Algorithms

Unit 12

Fundamental circuit matrix: A submatrix (of a circuit matrix) in which all rows corresponds to a set of fundamental circuits, is denoted by Bf. Example: Consider the graph G and its spanning tree T given in Figure 12.7A and 12.7B respectively. The fundamental circuit matrix with respect to the spanning tree T is given below

e4 e2 e5 e7 e6
Fig. 12.7 A Graph G

e4 e5 e7 e1
Fig. 12.7 B Spanning tree T

e3 e1

Bf =

1 2 3

Chrodschords e2 e3 e6 e1 e4 e5 e6 1 0 0 1 1 0 1 0 1 0 0 0 0 1

0 0 1 0 0 1 1
Matrix

Here, 1, 2, 3 are the circuits corresponds to the chords e2 , e3, e6 respectively. Self Assessment Question 5. An edge that does not lie in any circuit is said to be a .

12.4 Path matrix


This matrix is used in communications and transport net works. This is also a (0,1) matrix, which is defined for a specific pair of vertices in a graph, (x, y), and it is denoted by P(x, y). The rows in P(x, y) correspond to different paths between vertices x and y, and the columns correspond to the edges in G.
Sikkim Manipal University Page No. 225

Fundamentals of Algorithms

Unit 12

Definition: P(x, y) = (Pij)p q, where, p = number of paths between x and y and q = total number of edges.

Pij =

1, if jth edge lies in i th path, and 0, otherwise

Observations: i) A column of all 0s corresponds to an edge that does not lie in any path between x and y. ii) A column of all 1s corresponds to an edge that lies in every path between x and y. iii) There is no row with all 0s. Theorem: If the edges of a connected graph are arranged in the same order for the columns of the incidence matrix I and the path matrix P(x, y), then the product (mod 2) I PT(x, y) = M Where, the matrix M has 1s in two rows x and y, and the rest of the n-2 rows are all 0s. Self Assessment Question 6. The matrix used in communications and transport net works is .

12.5 Summary
In this unit, we discussed representation of a graph in several matrix forms. A matrix representation is a convenient and useful way of representing a graph to a computer. The algebra of matrices can be used to identify certain properties of graphs.

Sikkim Manipal University

Page No. 226

Fundamentals of Algorithms

Unit 12

12.6 Terminal Questions


1. Draw a graph for each of the following adjacency. i) ii) iii)

0 0 1 1 0 0 1 0 1 1 0 1 1 0 1 0

0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0

0 1 0 1 0 1 0 1 0

2. Write adjacent matrix for each of the following graphs. i)

v 1 o o v
3

v 2 o o v
4

ii)

iii)

v
1

v
1

v
2 o

o v
2

v 3 o

o v
5

v o
3

o v
4

o v
4

o v
5

3. Write adjacency matrix to represent the graphs shown below. i) ii) iii)

o o o

4. Draw the digraph corresponding to the following adjacency matrix.


0 0 1 1 0 0 1 0 1 1 0 1 1 1 0 0

Sikkim Manipal University

Page No. 227

Fundamentals of Algorithms

Unit 12

5. Verify whether or not the following graphs isomorphic.

v1 o G: v4 o v5 o G1: o v2
v1 3 o

v1 4

o o v1 5

v1 1

o v3
6. Find the incidence matrices of the following graphs. i)
v1 e5 v4

v1 2

(ii) c o

o
e1

o
e4

e8 b o e6 e5 e7 o a e4

d o

e2 e1 e3 o e

o
v2

e3

o
v3

e2

12.7 Answers
Self Assessment Questions 1. 2. 3. 4. 5. 6. Principal Diagonal Vertex Non-Singular Block Non-Circuit Edge Path Matrix

Sikkim Manipal University

Page No. 228

Fundamentals of Algorithms

Unit 12

Terminal Questions 1. i)

ii)

iii)

o
2.

o
0 1 0 1 0

0 1 1 0 0
i)

1 0 0 1 0 0 0 0 1 0 0 1 1 0 1 0 0 0 1 0

ii)

0 3 2 0 3 0 1 1 2 1 0 2 0 1 2 1

iii)

1 0 0 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 0 0

3.

i)

0 1 1 1 1 0 1 1 1 1 0 1 1 0 1 0

ii)

0 1 0 1 1 2 0 2 0

iii)

0 1 1 0 0 0 1 0 0 0 0 1 1 0 0 0

4.

o
1

5. Each of the graphs G and G have the adjacency matrix:

0 1 0 1 0 1 0 1 I(G) = I(G ) = 0 1 0 1 0 1 0 1 1
1

0 1 1 1 0 1 1 0

Therefore, G and G1 are isomorphic.


Sikkim Manipal University Page No. 229

Fundamentals of Algorithms

Unit 12

6.

i)
v1 v2 v3 v4

e1 e 2

e3 e4

e5

1 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 0 1 1

ii)
a b c d e f

e1 e2 e3 e4 e5 e6 e7 e8
0 0 0 1 0 1 0 0 0 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0

Sikkim Manipal University

Page No. 230

You might also like