Unit 5
Unit 5
Unit 5
Definition: The set of vertices V of a graph G may be infinite. A graph with an infinite vertex set or an
infinite number of edges is called an infinite graph.
Definition:A graph with a finite vertex set and a finite edge set is called a finite graph.
Definition: A graph in which each edge connects two different vertices and where no two edges
connect the same pair of vertices is called a simple graph.
Definition: Graphs that may have multiple edges connecting the same vertices are called
multigraphs.
Definition: The edges that connect a vertex to itself. Such edges are called loops
Definition: Graphs that may include loops, and possibly multiple edges connecting the same pair of
vertices or a vertex to itself are called pseudo graphs.
Definition: If direction is not assign to edges in a graph then such graph is call undirected graph.
Definition: A directed graph (or digraph) (V ,E) consists of a nonempty set of vertices V and a set of
directed edges (or arcs) E. Each directed edge is associated with an ordered pair of vertices. The
directed edge associated with the ordered pair (u, v) is said to start at u and end at v.
Definition: A directed graph has no loops and has no multiple directed edges, it is called a simple
directed graph.
Definition: Directed graphs that may have multiple directed edges from a vertex to a second
(possibly the same) vertex are used to model the networks.
Definition: A graph with both directed and undirected edges is called a mixed graph.
Definition: Two vertices u and v in an undirected graph G are called adjacent (or neighbors) in G if
u and v are endpoints of an edge e of G. Such an edge e is called incident with the vertices u
and v and e is said to connect u and v.
Definition: The degree of a vertex in an undirected graph is the number of edges incident with it,
except that a loop at a vertex contributes twice to the degree of that vertex. The degree of the
vertex v is denoted by deg(v).
Definition: A vertex of degree zero is called isolated.
Definition: A vertex is pendant if and only if it has degree one.
Question: Determine whether the graph shown has directed or undirected edges, whether it has
multiple edges, and whether it has one or more loops. Use your answers to determine the type of graph
from above Table.
Question: Determine the number of vertices and edges and find the in-degree and out-degree of each
vertex for the given directed multigraph.
Types of Graphs:
Regular graphs: A simple graph is called regular if every vertex of this graph has the same degree. A
regular graph is called n-regular if every vertex in this graph has degree n.
2-regular 3-regular
Question: For which values of n are the following graphs regular? (i) K n (ii) C n
Complete Graphs: A complete graph on n vertices, denoted by K n , is a simple graph that contains
exactly one edge between each pair of distinct vertices.
Cycles A cycle Cn, n ≥ 3, consists of n vertices v1, v2, . . . , vn and edges {v1, v2),{v2, v3}, . . . , {vn−1, vn}, and {vn,
v1}. The cycles C3 , C 4 , C5 & C 6 are displayed in figure
Complementary graph: The complementary graph G of a simple graph G has the same vertices as
G. Two vertices are adjacent in G if and only if they are not adjacent in G.
Question: Describe each of these graphs. (i) K n (ii) C n
Subgraph: A subgraph of a graph G = (V ,E) is a graph H = (W, F), where W ⊆ V and F ⊆ E. A
subgraph H of G is a proper subgraph of G if H = G.
Question: Draw all subgraphs of this graph.
Adjacency Matrix (for undirected graph): Suppose that G = (V ,E) is a simple graph where |V| = n.
The adjacency matrix A (or AG ) of 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 v i and v j 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 ], then
1, if {vi , v j }is an edge of G
aij =
0, otherwise
Adjacency Matrix (for directed graph): An adjacency matrix is defined as follows: Let G be a
graph with "n" vertices that are assumed to be ordered from v1 to vn.
The n x n matrix A, in which aij= 1 if there exists a path from vi to vj
aij = 0 otherwise
Question: Draw a graph with the adjacency matrix with respect to the ordering of vertices a, b, c, d.
Incidence matrix (for undirected graph): Let G = (V ,E) be an undirected graph. Suppose that
v1 , v 2 ,....., v n are the vertices and e1 , e2 ,....., em are the edges of G. Then the incidence matrix with
respect to this ordering of V and E is the n × m matrix M = [mij ], where
1, when ei is incident with vertex vi
mij =
0, otherwise
Incidence matrix (for directed graph): The incidence matrix of a directed graph is a n × m
matrix B where n and m are the number of vertices and edges respectively,
such that bi,j = −1 if the edge ej leaves vertex vi,
=1 if it enters vertex vi
= 0 otherwise
Question: Represent the graph shown in the figure with an incidence matrix
Isomorphism
➢ Two graphs have exactly the same form, in the sense that there is a one-to-one correspondence
between their vertex sets that preserves edges, then we say that the two graphs are isomorphic.
➢ The simple graphs G1 = (V1 , E1 ) and G2 = (V2 , E 2 ) are isomorphic if there exists 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 G1 , for all a and b in V1 . Such a function f is called an
isomorphism. Two simple graphs that are not isomorphic are called non-isomorphic.
Question: Show that the graphs G = (V ,E) and H = (W, F), displayed in Figure are isomorphic.
Question: Show that the following graphs G=(V,E) and H=(W, F) are not isomorphic.
Solution: The cut vertices of G1 are b, c, and e. The removal of one of these vertices (and its adjacent
edges) disconnects the graph. The cut edges are {a, b} and {c, e}. Removing either one of these edges
disconnects G1.
➢ A directed graph is strongly connected if there is a path from a to b and from b to a whenever
a and b are vertices in the graph.
➢ A directed graph is weakly connected if there is a path between every two vertices in the
underlying undirected graph.
Question: Does each of these lists of vertices form a path in the following graph? Which paths are
simple? Which are circuits? What are the lengths of those that are paths?
a) a, e, b, c, b b) a, e, a, d, b, c, a c) e, b, a, d, b, e d) c, b, d, a, e, c
Question: Determine whether the graphs G and H shown in Figure are isomorphic.
Solution: Both G and H have five vertices and six edges, both have two vertices of degree three and
three vertices of degree two, and both have a simple circuit of length three, a simple circuit of length
four, and a simple circuit of length five. Because all these isomorphic invariants agree, G and H may
be isomorphic.
Question: How many paths of length four are there from a to d in the simple graph G in Figure?
Solution: The adjacency matrix of G (ordering the vertices as a, b, c, d) is
The adjacency matrix of G (ordering the vertices as a, b, c, d) is there are exactly eight paths of length four from a to
d. By inspection of the graph, we see that a, b, a, b, d; a, b, a, c, d; a, b, d, b, d; a, b, d, c, d; a, c, a, b, d; a, c, a, c, d;
a, c, d, b, d; and a, c, d, c, d are the eight paths of length four from a to d.
Remark: 1) DIRAC’S THEOREM If G is a simple graph with n vertices with n ≥ 3 such that the
degree of every vertex in G is at least n/2, then G has a Hamilton circuit.
2) ORE’S THEOREM If G is a simple graph with n vertices with n ≥ 3 such that
deg(u) + deg(v) ≥ n for every pair of nonadjacent vertices u and v in G, then G has a Hamilton circuit.
Definition: Planar Graphs: A graph is called planar if it can be drawn in the plane without any edges
crossing (where a crossing of edges is the intersection of the lines or arcs representing them at a point
other than their common endpoint). Such a drawing is called a planar representation of the graph.
Question: Is K4 (shown in Figure1 with two edges crossing) planar?
Solution: K4 is planar because it can be drawn without crossings, as shown in Figure 2
fig 1 fig 2
Question: Is Q3, shown in Figure, planar?
Definition: A coloring of a simple graph is the assignment of a color to each vertex of the graph so
that no two adjacent vertices are assigned the same color.
Definition: The chromatic number of a graph is the least number of colors needed for a coloring of
this graph. The chromatic number of a graph G is denoted by χ(G). (Here χ is the Greek letter chi.)
Definition: THE FOUR COLOR THEOREM: The chromatic number of a planar graph is no
greater than four.
Question: What are the chromatic numbers of the graphs G and H shown in Figure?
Solution: The chromatic number of G is at least three, because the vertices a, b, and c must
be assigned different colors. To see if G can be colored with three colors, assign red to a, blue
to b, and green to c. Then, d can (and must) be colored red because it is adjacent to b and c.
Furthermore, e can (and must) be colored green because it is adjacent only to vertices colored
red and blue, and f can (and must) be colored blue because it is adjacent only to vertices colored
red and green. Finally, g can (and must) be colored red because it is adjacent only to vertices
colored blue and green. This produces a coloring of G using exactly three colors. Figure 4
displays such a coloring.
The graph H is made up of the graph G with an edge connecting a and g. Any attempt to
color H using three colors must follow the same reasoning as that used to color G, except at the
last stage, when all vertices other than g have been colored. Then, because g is adjacent (in H)
to vertices colored red, blue, and green, a fourth color, say brown, needs to be used. Hence, H
has a chromatic number equal to 4. A coloring of H is shown in Figure
Definition: An edge coloring of a graph is an assignment of colors to edges so that edges incident
with a common vertex are assigned different colors. The edge chromatic number of a
graph is the smallest number of colors that can be used in an edge coloring of the graph. The edge
chromatic number of a graph G is denoted by χ’(G).
Question: Find the edge chromatic number of each of the graphs in figure.
Clique: Let G be a graph, Z be a subset of its vertex set. If every pair of vertices in Z are adjacent then
Z is called a clique of G.
Example: The following graph is adjacent because every vertex is connected to every other vertex and
its clique number is 4.
Clique Number: The cardinal number of the largest clique in a graph. G is called the clique number
of G. It is denoted by (G ) .
Perfect Graphs: A perfect graph is a graph in which the chromatic number of every induced
subgraph equals the size of the largest clique of that subgraph.
For example:
Here chromatic number of the above graph is 3 i.e. (G ) = 3 and clique number (G ) =3. Therefore
perfect graph.
Definition: Graphs that have a number assigned to each edge are called weighted graphs.
Example: Use Dijkstra’s algorithm to find the length of a shortest path between the vertices a and z in
the weighted graph displayed in Figure
Solution: The steps used by Dijkstra’s algorithm to find a shortest path between a and z are shown in
Figure 4. At each iteration of the algorithm the vertices of the set Sk are circled. A shortest path from a
to each vertex containing only vertices in Sk is indicated for each iteration. The algorithm terminates
when z is circled.We find that a shortest path from a to z is a, c, b, d, e, z, with length 13.
Tree: A tree is a connected undirected graph with no simple circuits.
➢ A tree is a connected undirected graph with
– No simple circuits
– No multiple edges
– No loops
➢ An undirected graph is a tree if and only if there is a unique simple path between any two
of its vertices
Question: Which graphs are trees?
Answer: G1, G2
Rooted trees: A rooted tree is a tree in which one vertex has been designated as the root and every
edge is directed away from the root.
Definitions: T is a rooted tree. If v is a vertex in T other than the root, the parent of v is the unique
vertex u such that there is a directed edge from u to v (the reader should show that such a vertex is
unique). When u is the parent of v, v is called a child of u. Vertices with the same parent are called
siblings. The ancestors of a vertex other than the root are the vertices in the path from the root to this
vertex, excluding the vertex itself and including the root (that is, its parent, its parent’s parent, and so
on, until the root is reached). The descendants of a vertex v are those vertices that have v as an
ancestor. A vertex of a rooted tree is called a leaf if it has no children. Vertices that have children are
called internal vertices. The root is an internal vertex unless it is the only vertex in the graph, in
which case it is a leaf. If a is a vertex in a tree, the subtree with a as its root is the subgraph of the tree
consisting of a and its descendants and all edges incident to these descendants.
Question: In the rooted tree T (with root a) shown in Figure, find the parent of c, the children of g, the
siblings of h, all ancestors of e, all descendants of b, all internal vertices, and all leaves. What is the
subtree rooted at g?
Solution: The graph G is connected, but it is not a tree because it contains simple circuits. Remove the
edge {a, e}. This eliminates one simple circuit, and the resulting subgraph is still connected and still
contains every vertex of G. Next remove the edge {e, f } to eliminate a second simple circuit. Finally,
remove edge {c, g} to produce a simple graph with no simple circuits. This subgraph is a spanning
tree, because it is a tree that contains every vertex of G.
The sequence of edge removals used to produce the spanning tree is illustrated in Figure
Question: Use Kruskal’s algorithm to find a minimum spanning tree in the weighted graph shown in
Figure.
Solution: A minimum spanning tree and the choices of edges at each stage of Kruskal’s algorithm are
shown in Figure