Discrete Mathematics
(CSC 1204)
9.3 Representing Graphs and
Graph Isomorphism
1

Representing Graphs and Graph Isomorphism
•
Graph Representation
:
–
Adjacency lists
–
Adjacency matrices
–
Incidence matrices
•
Graph isomorphism:
–
Two graphs are isomorphic iff they are identical except for
their node names
2

Representing Graphs
•
One way to represent
a graph without multiple edges
is to
list
all the edges of the graph.
•
Another way to represent
a graph with no multiple edges
is to
use
adjacency lists
, which specify the vertices that are
adjacent to each vertex of the graph.
•
Adjacency Lists
: A table with
1 row per vertex
, listing its
adjacent vertices.
•
Directed Adjacency Lists
: A table with
1 row per node
, listing
the
terminal
nodes
of each edge
incident
from
that node
.
3

Representing Graphs
•EXAMPLE 1(p.612): Use adjacencyliststo describe the simple graph given in Figure 1.
4

Representing Graphs
•EXAMPLE 2(p.612): Represent the directed graph shown in Figure 2 by listing all the vertices that are the terminal vertices of edges starting at each vertex of the graph.
5

Representing Graphs
•
Two types of matrices commonly used to represent
graphs –
1)
Adjacency matrix
2)
Incidence matrix
•
Adjacency matrix
:
A matrix representing a graph
using the
adjacency of vertices
.
•
Incidence matrix
: A matrix representing a graph using
the
incidence of edges and vertices
.
6

Adjacency matrices
•Suppose that G = (V, E) is a simple graph where |V|= n. Suppose that the vertices of G are listed arbitrarily as v1, v2, …., vn. The adjacency matrix Aof G, with respect to this listing of the vertices, is the n x n zero-one matrix with 1 as its (i,j)th entry when viand vj are adjacent, and 0 as its (i,j)th entry when they are not adjacent.•In other words, if its adjacency matrix is A= [ aij], thenaij= 1if {vi, vj} is an edge of G,0otherwise
7

Adjacency matrices : Example 3(p.612)
8