GT - Module 5 New
GT - Module 5 New
GT - Module 5 New
Incidence Matrix
Let G be a graph with n vertices, e edges, and no self-loops. Define an n by e matrix A = [aij],
whose n rows correspond to the n vertices and the e columns correspond to the e edges, as follows
:
= 0, otherwise.
Such a matrix A is called the vertex-edge incidence matrix, or simply incidence matrix.
Matrix A for a graph G is also written as A(G).
a)
1
b)
2
Remarks on Incidence Matrix
● The incidence matrix contains only two elements, 0 and 1. Such a matrix is called a
binary matrix or a (0, 1)-matrix.
● Since every edge is incident on exactly two vertices, each column of A has exactly two
l′s.
● The number of l′s in each row equals the degree of the corresponding vertex.
● A row with all 0′s, therefore, represents an isolated vertex.
● Parallel edges in a graph produce identical columns in its incidence matrix.
● If a graph G is disconnected and consists of two components g1 and g2 , the incidence
matrix A(G) of graph G can be written in a block-diagonal form as
where A(g1) and A(g2) are the incidence matrices of components g1 and g2 . This
observation results from the fact that no edge in g1 is incident on vertices of g2 , and vice
versa.
Theorems
● Two graphs G1 and G2 are isomorphic if and only if their incidence matrices A(G1) and
A(G2) differ only by permutations of rows and columns.
● If A(G) is an incidence matrix of a connected graph G with n vertices, the rank of A(G) is
n − 1.
Adjacency Matrix
The adjacency matrix of a graph G with n vertices and no parallel edges is an n by n symmetric
binary matrix X = [xij ] defined over the ring of integers such that
3
Q3: Find the adjacency matrix of the following graphs:
a)
4
b)
5
Remarks on Adjacency Matrix
● The entries along the principal diagonal of X are all 0′s if and only if the graph has no
self-loops. A self-loop at the ith vertex corresponds to xij = 1.
● The definition of adjacency matrix makes no provision for parallel edges.
● If the graph has no self-loops and no parallel edges, the degree of a vertex equals the
number of 1′s in the corresponding row or column of X.
Circuit Matrix
Let the number of different circuits in a graph G be q and the number of edges in G be e. Then a
circuit matrix B = [bij] of G is a q by e, (0, 1)-matrix defined as follows:
= 0, otherwise.
a)
The graph has four different circuits, {a, b}, {c, e, g}, {d, f, g}, and {c, d, f, e}. Therefore, its
circuit matrix is a 4 by 8, (0, l)-matrix as shown:
6
b)
Path Matrix
● A path matrix is defined for a specific pair of vertices in a graph, say (x, y), and is
written as 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.
● That is, the path matrix for (x, y) vertices is P(x, y) = [pij ], where
= 0, otherwise
7
Q6: Find P(v3v4)
Consider all paths between vertices v3 and v4 in Figure. There are three different paths; {h, e},
{h, g, c}, and {h, f, d, c}. Let us number them 1, 2, and 3, respectively. Then we get the 3 by 8
path matrix P(v3 , v4 ):
Coloring
● Given a graph G with n vertices and are asked to paint its vertices such that no two adjacent
vertices have the same color. What is the minimum number of colors that you would
require? This constitutes a coloring problem.
Chromatic number
● Painting all the vertices of a graph with colors such that no two adjacent vertices have the
same color is called the proper coloring (or sometimes simply coloring) of a graph.
● A graph in which every vertex has been assigned a color according to a proper coloring is
called a properly colored graph.
● A given graph can be properly colored in many different ways.
8
Figure shows three different proper colorings of a graph.
● The proper coloring which is of interest to us is one that requires the minimum number of
colors.
● A graph G that requires κ different colors for its proper coloring, and no less, is called a
κ-chromatic graph, and the number κ is called the chromatic number of G.
● The graph in the above Fig. is 3- chromatic.
● For coloring problems we need to consider only simple, connected graphs.
Note:
9
adjacent vertices will have the same color. If n is odd, the nth and first vertex will be
adjacent and will have the same color, thus requiring a third color for proper coloring.)
Proof: Select any vertex v in the given tree T. Consider T as a rooted tree at vertex v. Paint v with
color 1. Paint all vertices adjacent to v with color 2. Next, paint the vertices adjacent tothese
(those that just have been colored with 2) using color 1. Continue this process till every vertex in
T has been painted. (See Fig. 8-2). Now in T we find that all vertices at odd distances from v have
color 2, while v and vertices at even distances from v have color 1.
Now along any path in T the vertices are of alternating colors. Since there is one and only
one path between any two vertices in a tree, no two adjacent vertices have the same color. Thus T
has been properly colored with two colors. One color would not have been enough.
THEOREM 5.2: A graph with at least one edge is 2-chromatic if and only if it has no circuits
of odd length.
Proof: Let G be a connected graph with circuits of only even lengths. Consider a spanning tree T
in G. Using the coloring procedure and the result of Theorem 8-1, let us properly color T with two
colors. Now add the chords to T one by one. Since G had no circuits of odd length, the end vertices
of every chord being replaced are differently colored in T. Thus G is colored with two colors, with
no adjacent vertices having the same color. That is, G is 2- chromatic.
Conversely, if G has a circuit of odd length, we would need at least three colors just for
that circuit. Thus the theorem.
10
Chromatic polynomial
● A given graph G of n vertices can be properly colored in many different ways using a
sufficiently large number of colors. This property of a graph is expressed by means of a
polynomial called the chromatic polynomial of G.
● The value of the chromatic polynomial Pn (λ) of a graph with n vertices gives the
number of ways of properly coloring the graph, using λ or fewer colors.
● Let ci be the different ways of properly coloring G using exactly i different colors. Since i
colors can be chosen out of λ colors in
there are different ways of properly coloring G using exactly i colors out of λ
colors.
● Since i can be any positive integer from 1 to n, the chromatic polynomial is a sum of
these terms; that is,
● Each ci has to be evaluated individually for the given graph. For example, any graph with
even one edge requires at least two colors for proper coloring, and therefore c1 = 0.
● A graph with n vertices and using n different colors can be properly colored in n! ways;
that is,
cn = n!
11
● The Chromatic polynomial,
● Since the graph in Fig. 8-4 has a triangle, it will require at least three different colors for
proper coloring. Therefore, c1 = c2 = 0 and c5 = 5!.
● To evaluate c3, suppose that we have three colors x, y, and z. These three colors can be
assigned properly to vertices v1 , v2 , and v3 in 3! = 6 different ways. Having done that,
we have no more choices left, because vertex v5 must have the same color as v3 , and v4
must have the same color as v2 . Therefore, c3 = 6.
● Similarly, with four colors, v1 , v2 , and v3 can be properly colored in 4·6 = 24 different
ways. The fourth color can be assigned to v4 or v5 , thus providing two choices. The fifth
vertex provides no additional choice. Therefore, c4 = 24·2 = 48.
12
THEOREM 5.3 A graph of n vertices is a complete graph if and only if its chromatic
polynomial is Pn (λ) = λ(λ − 1)(λ − 2) . . . (λ − n + 1).
Proof: With λ colors, there are λ different ways of coloring any selected vertex of a graph. A
second vertex can be colored properly in exactly λ – 1 ways, the third in λ – 2 ways, the fourth in
λ – 3 ways, . . . , and the nth in λ – n + 1 ways if and only if every vertex is adjacent to every other.
That is, if and only if the graph is complete.
THEOREM 8-5 An n-vertex graph is a tree if and only if its chromatic polynomial Pn (λ) =
λ(λ − 1) n − 1
Matchings
● A matching in a graph is a subset of edges in which no two edges are adjacent.
● A single edge in a graph is a matching.
● A maximal matching is a matching to which no edge in the graph can be added.
For example, in a complete graph of three vertices (i.e., a triangle) any single edge is a
maximal matching.
● The maximal matchings with the largest number of edges are called the largest maximal
matchings. In Fig. 8-7(b), a largest maximal matching is shown in heavy lines.
● The number of edges in a largest maximal matching is called the matching number of the
graph.
● In a bipartite graph having a vertex partition V1 and V2 , a complete matching of vertices
in set V1 into those in V2 is a matching in which there is one edge incident with every
vertex in V1 .
● In other words, every vertex in V1 is matched against some vertex in V2 .
● Clearly, a complete matching (if it exists) is a largest maximal matching, whereas the
converse is not necessarily true.
Coverings
● In a graph G, a set g of edges is said to cover G if every vertex in G is incident on at least
one edge in g.
13
● A set of edges that covers a graph G is said to be an edge covering, a covering subgraph,
or simply a covering of G. For example, a graph G is trivially its own covering.
● A spanning tree in a connected graph (or a spanning forest in an unconnected graph) is
another covering.
● A Hamiltonian circuit (if it exists) in a graph is also a covering.
● Minimal covering – A covering from which no edge can be removed without destroying
its ability to cover the graph. In Fig. 8-9 a graph and two of its minimal coverings are shown
in heavy lines.
Note:
1. A covering exists for a graph if and only if the graph has no isolated vertex.
2. A covering of an n-vertex graph will have at least ⌈n/2⌉ edges. (⌈n⌉ denotes the
smallest integer not less than x.)
3. Every pendant edge in a graph is included in every covering of the graph.
4. Every covering contains a minimal covering.
5. If we denote the remaining edges of a graph by (G – g), the set of edges g is a
covering if and only if, for every vertex V, the degree of vertex in (G – g) ≤ (degree
of vertex v in G) – 1.
6. No minimal covering can contain a circuit, for we can always remove an edge from
a circuit without leaving any of the vertices in the circuit uncovered. Therefore, a
minimal covering of an n-vertex graph can contain no more than n –1 edges.
7. A graph, in general, has many minimal coverings, and they may be of different
sizes (i.e., consisting of different numbers of edges). The number of edges in a
minimal covering of the smallest size is called the covering number of the graph.
14
Proof:
Suppose that a covering g contains a path of length three, and it is v1e1v2e2v3e3v4 . Edge e2
can be removed without leaving its end vertices v2 and v3 uncovered. Therefore, g is not a minimal
covering.
Conversely, if a covering g contains no path of length three or more, all its components must be
star graphs (i.e., graphs in the shape of stars; see Fig. 8- 10). From a star graph no edge can be
removed without leaving a vertex uncovered. That is, g must be a minimal covering.
15
Five color problem
THEOREM The vertices of every planar graph can be properly colored with five colors.
Proof:
● The theorem will be proved by induction. Since the vertices of all graphs (self-loop-free,
of course†) with 1, 2,3,4, or 5 vertices can be properly colored with five colors, let us
assume that vertices of every planar graph with n – 1 vertices can be properly colored with
five colors.
● Then, if we prove that any planar graph G with n vertices will require no more than five
colors, we shall have proved the theorem.
● Consider the planar graph G with n vertices. Since G is planar, it must have at least one
vertex with degree five or less. Let this vertex be v. Let G′ be a graph (of n – 1 vertices)
obtained from G by deleting vertex v (i.e., v and all edges incident on v).
● Graph G′ requires no more than five colors, according to the induction hypothesis.
● Suppose that the vertices in G′ have been properly colored, and now we add to it v and all
edges incident on v. If the degree of v is 1, 2, 3, or 4, we have no difficulty in assigning a
proper color to v. This leaves only the case in which the degree of v is five, and all the five
colors have been used in coloring the vertices adjacent to v, as shown in Fig. 8- 15(a).
● Suppose that there is a path in G′ between vertices a and c colored alternately with colors
1 and 3, as shown in Fig. 8-15(b). Then a similar path between b and d, coloredalternately
with colors 2 and 4, cannot exist; otherwise, these two paths will intersect and cause G to
be nonplanar.
● If there is no path between b and d colored alternately with colors 2 and 4, starting from
vertex b we can interchange colors 2 and 4 of all vertices connected to b through vertices
of alternating colors 2 and 4. This interchange will paint vertex b with color 4 and yet
16
keep G′ properly colored. Since vertex d is still with color 4, we have color 2 left over with
which to paint vertex v. Had we assumed that there was no path between a and c of vertices
painted alternately with colors 1 and 3, we would have released color 1 or 3 instead of color
2. And thus the theorem.
- Use the color with the lowest number to color it that hasn't been applied to any
colored vertices before surrounding it.
- Assign a new color to vertex v if all previously used colors can be seen on the
vertices next to it.
Example:
Next vertex is 1, its adjacent vertex two is not colored yet, and vertex 0 is not adjacent, so we
color vertex one the same color as vertex 0.
17
Next vertex is 2. Its adjacent vertices 0,1 are colored with the same color so we will color it with
a different one.
Next vertex is 3, its adjacent vertex two is colored, and vertex 4 is not, so we color it with the same
color as vertex 0 because it is not adjacent to 2.
Next vertex is 4; as we can see, its adjacent vertices 2 and 3 are already colored, and all previously
used colors appear on vertices adjacent to vertex 4, so we assign a new different colorto it.
18