Module1 BCS405B New 1
Module1 BCS405B New 1
MODULE-1
Introduction to Graphs: Introduction- Basic definition – Application of graphs – finite, infinite and bipartite
graphs – Incidence and Degree – Isolated vertex, pendant vertex and Null graph. Isomorphism, sub-graphs,
walks, paths and circuits, connected graphs, disconnected graphs and components.
Undirected Graph: Let 𝑉 be a nonempty set, and 𝐸 be a set of unordered pairs of elements of 𝑉.
Then the pair 𝐺( 𝑉, 𝐸 ) is called graph.
𝑉 is called set of vertices (or nodes) and 𝐸 , the set of edges (or arcs) .
Multigraph: If there exists two or more (in digraph, in the same direction) edges between any two vertices
(Parallel edges) then the graph is called multigraph.
Simple graph: A loop free graph without multiple edges is called simple graph otherwise general graph.
Examples of graphs.
3. Multigraph:
4. Simple graph:
𝑣1 𝑒1 𝑣2
𝑒8
·
𝑒2 𝑒5
𝑒6 𝑣3
𝑒3
𝑣6
𝑒4 𝑒7
𝑣4 𝑣5
Fig: 1.1
Review questions:
Finite graph: A graph 𝐺( 𝑉, 𝐸 ) is said to be finite if |𝑉| and | 𝐸| are both finite, otherwise infinite graph.
Bipartite graph: Suppose a simple graph G is such that its vertex set V is the union of its mutually disjoint non-
empty subsets V1 and V2 which are such that each edge in G joins a vertex in V1 and a vertex in V2 . Then G is
called bipartite graph. If E is the edge set of the graph, then the graph is denoted by G( V1 , V2 ; E). The set V1
and V2 are called bipartite (or partitions) of the vertex set V .
𝑎 𝑐
Example: 𝑒
𝐺 𝑓
𝑏 𝑑 𝑔
Clearly the vertex set 𝑉 = {𝑎, 𝑏, 𝑐, 𝑑, 𝑒, 𝑓, 𝑔} can be partitioned into two nonempty subsets 𝑉1 = {𝑎, 𝑑, 𝑓} and
𝑉2 = {𝑏, 𝑐, 𝑒, 𝑔}, such that each edge in G with one end vertex in V1 and another end vertex in V2 .
Or there is no edge between the any two vertices of V1 and any two vertices of V2 .
Therefore the graph G is bipartite, and denoted by G( V1 , V2 ; E).
For any two partition of the bipartite graph, it is convenient to take the smaller set as vertex set V1 ,
i.e. |V1 | ≤ |𝑉2 |.
Complete bipartite graph: A bipartite graph G( V1 , V2 ; E) is called a complete bipartite, if there is an edge
between every vertex in V1 and every vertex in V2 ,
and denoted by 𝐾𝑚,𝑛 , where |V1 | = 𝑚 and |𝑉2 | = 𝑛 with 𝑚 ≤ 𝑛 .
𝐾2,2: 𝐾2,3:
𝑎 𝑐
𝑒
Consider the graph 𝐺.
𝑓
𝑏 𝑑 𝑔
Let 𝑎 ∈ 𝑉1, there are three edges with one end vertex is 𝑎, therefore if graph is bipartite another end
vertices of these three edges 𝑏, 𝑐 and 𝑑 must be in 𝑉2. But there is an edge between 𝑏 and 𝑑. Therefore given
graph is not bipartite.
Review questions:
2. Is a graph with no edge and more than one vertex is bipartite? Give reason.
𝑏 𝑐
Lecture 3: Incidence and Adjacency, degree of a vertex, isolated vertex, pendent vertex:
Incidence: When a vertex 𝑣 is an end vertex of an edge 𝑒, then 𝑣 and 𝑒 are said to be incident with each other.
The edge 𝑒 is incident on a vertex 𝑣, or the vertex 𝑣 is incident on an edge 𝑒.
Adjacency: Two nonparallel edges are said to be adjacent if they are incident on a common vertex.
Similarly, two vertices are said to be adjacent if there is an edge between them.
Degree of a vertex: Number of edges incident on a vertex 𝑣 (self-loop counted twice) is called degree of 𝑣
Or valency of 𝑣 and denoted by 𝑑(𝑣).
·
𝑒2 𝑒5
𝑒6 𝑣3
𝑒3
𝑣6
𝑒4 𝑒7
𝑣4 𝑣5
Null graph: A graph containing only vertices, no edge is called null graph.
Regular graph: A graph in which all the vertices are of equal degree is called a regular graph.
If all the vertices are of degree k, then we call k-regular graph.
Example:
3-regular graph
2-regular graph
Series edges: If the degree of a vertex 𝑣 is 2, then the two edges incident on 𝑣 are said to be in series.
Example: In the graph below, edges 𝑒1 and 𝑒5 are in series, similarly edges 𝑒3 and 𝑒4 are in series.
𝑒2
𝑒3
𝑒6
𝑒1
𝑒4
𝑒5
Even though edges 𝑒1 and 𝑒2 are adjacent but not series edges. Because common vertex is of degree 3.
Now we can define bipartite graph using the adjacency, incidence concept.
A graph G is bipartite if the vertex set V can be partitioned in to two nonempty subsets 𝑉1 and 𝑉2 such that no
two vertices of the same vertex set are adjacent. Or every edge of the graph is incident on one vertex of 𝑉1 and
one vertex of 𝑉2.
A simple bipartite graph is complete bipartite if every vertex of 𝑉1 is adjacent to each vertex of 𝑉2.
Review questions:
2. A graph with no edge and more than one vertex is bipartite. How many partitions are there in a null graph
containing 3 vertices?
3. If the degree of a vertex is 4, then how many edges are incident on that vertex?
4. If the degree of a vertex is 2, then the graph has series edges. Say true or false. If false give reason.
5. An edge incident on the pendent vertex is called pendent edge. Degree of another end vertex of pendent edge
is 2 or more. Say true or false.
1. For an undirected graph, prove that ∑ dig(𝑣) = 2𝑒 , and number of odd degree vertices is even.
∴ ∑ dig(𝑣) = 2𝑒 .
Let 𝑉1 and 𝑉2 be the set of vertices of a graph with odd and even degrees respectively.
3. Determine |𝑉| if
7. Let G be a loop-free connected undirected graph containing more than one vertex. Prove that G contains at
least two vertices of same degree.
Proof: Let n be the number of vertices of G. Then a vertex v can be adjacent to at most n-1 vertices of G and at
least one vertex. Therefore 1 ≤ deg(𝑣) ≤ 𝑛 − 1. Let degrees {1, 2, 3, … . . 𝑛 − 1 } be 𝑛 − 1 pigeonholes and 𝑛
vertices be 𝑛 pigeons. Then by pigeonhole principle at least one pigeonhole contains more than one pigeons.
That is at least two vertices are of same degrees.
Review questions:
C D
Problem is whether a person can start from any land area A, B, C or D walk through all the seven bridges
exactly once and then return to the starting point. Euler represented the four land areas as vertices and the
bridges as edges of a graph. Euler proved that a solution for this problem does not exist.
A
C D
Utilities Problem: There are three houses 𝐻1 , 𝐻2 and 𝐻3 , each to be connected to each of the three utilities-
water(W), gas(G) and electricity(E) by means of pipes. Is it possible to make such connections without
crossovers of the pipes?
This problems can be represented by a graph by taking houses and utility supply centers are vertices and pipe
connections as edges.
𝐻1 𝐻2 𝐻3
𝑊 𝐺 𝐸
Review questions:
1. Draw the graph representing problems of two houses and three utilities.
2. Draw the graph of following chemical compounds by representing atoms by vertices and chemical bonds
between them by edges.
Isomorphic Graphs:
Let G1 ( V1 , E1 ) and G2 (V2 , E2 ) be two undirected graphs. If there exists a function 𝑓 from V1 to V2 such that
i) 𝑓 is bijective. (One-one and onto).
ii) {𝑎, 𝑏} ∈ E1 ⟺ {𝑓(𝑎), 𝑓(𝑏)} ∈ E2 , for all 𝑎, 𝑏 ∈ V1 .
Then G1 and G2 are isomorphic graphs denoted by G1 ≅ G2 .
Or simply, Two graphs G1 ( V1 , E1 ) and G2 (V2 , E2 ) are said to be isomorphic if there is a one to one
correspondence between their vertices and between their edges such that the incidence relationship is preserved.
Example: Show that the following two graphs are isomorphic.
a v
u x
f b and
e c w
d y z
Solution: Consider the function 𝐹 from V1 to V2 such that 𝐹(a) = u, 𝐹(c) = v, 𝐹(e) = x,
𝐹(d) = y, 𝐹(b) = z , 𝐹(f) = w .
Clearly F is one to one and onto function.
𝑎 𝑒1 𝑣5
𝑒 𝑣4
𝑒3 𝑣3
4 2
5 1
𝑒2
𝑒4 𝑒6
𝑐
3
6
𝑑 𝑒5 𝑣2
𝑣1
𝑏
Solution: In both the graph there is only one pendent vertex, and one vertex with degree two, the function
𝑓 from V1 to V2 such that 𝑓(𝑏) = 𝑣2 , 𝑓(𝑒) = 𝑣5 . In first graph pendent vertex is adjacent to the vertex 𝑑,
therefore 𝑓(𝑑) = 𝑣4 . The remaining two vertices 𝑎, 𝑐 are adjacent to the vertices 𝑏, 𝑑 . Similarly vertices 𝑣1 , 𝑣3
are adjacent to the vertices 𝑣2 , 𝑣4 . ∴ 𝑓(𝑎) = 𝑣1 and 𝑓(𝑐) = 𝑣3 Or 𝑓(𝑎) = 𝑣3 and 𝑓(𝑐) = 𝑣1 .
Let 𝑓 be a function from V1 to V2 such that 𝑓(𝑎) = 𝑣1 , 𝑓(𝑏) = 𝑣2 , 𝑓(𝑐) = 𝑣3 , 𝑓(𝑑) = 𝑣4 and 𝑓(𝑒) = 𝑣5 .
Clearly 𝑓 is one-one and onto. The edges 1, 2, 3, 4, 5, 6 corresponds to 𝑒1 , 𝑒2 , 𝑒3 , 𝑒4 , 𝑒5 , 𝑒6 respectively.
Therefore given two graphs are isomorphic.
Consider the following two graphs: Both the graphs are having 6 vertices, 5 edges, one vertex of degree 3, two
vertices of degree 2, and 3 pendent vertices.
But in the first graph, two pendent vertices are adjacent to the vertex with degree 3 and in the second graph,
only one pendent vertex is adjacent to the degree 3 vertex. Hence there is no isomorphic function preserving
incidence relationship.
Review questions:
1. If two graphs are isomorphic then there is unique isomorphic function. True or false?
2. Whether any bijective function between the vertices of two isomorphic graphs if isomorphic function?
3. Give reason why the following two graphs are not isomorphic?
i) and
ii)
and
Induced subgraph: Let 𝐺(𝑉, 𝐸) be a graph and 𝑈 is any nonempty subset of 𝑉 . The subgraph of 𝐺
induced by 𝑈 is the subgraph whose vertex set is U and contains all the edges of G which
are incident with the vertices of U and denoted by < 𝑈 >.
𝑏 𝑐 𝑑 𝑒
𝑎 𝑎
Some Subgraphs:
𝑏 𝑑 𝑐 𝑑 𝑒
𝑎 𝑎
𝑏 𝑐 𝑑 𝑒 𝑏 𝑐 𝑑 𝑒
𝑎 𝑎
Walk: Let 𝑥 , 𝑦 be (not necessarily distinct) vertices of a graph 𝐺( 𝑉, 𝐸 ). 𝑥‐𝑦 walk in G is a finite alternating
sequence 𝑥 = 𝑥0 , 𝑒1 , 𝑥1 , 𝑒2 , 𝑥2 , 𝑒3 ⋯ ⋯ , 𝑒𝑛−1 𝑥𝑛−1 , 𝑒𝑛 𝑥𝑛 = 𝑦 of vertices and edges from G starting at
vertex 𝑥 and ending at 𝑦 and involving 𝑛 distinct edges with 𝑒𝑖 = {𝑥𝑖−1 , 𝑥𝑖 } , where 1 ≤ 𝑖 ≤ 𝑛.
Number of edges present in the walk is called length of the walk.
If 𝑥 = 𝑦 , then 𝑥‐𝑦 walk is called closed walk. If 𝑥 ≠ 𝑦 , then 𝑥‐𝑦 walk is called open walk.
Path: If no vertex in 𝑥‐𝑦 open walk appears more than once then, the 𝑥‐𝑦 walk is called path.
Circuit: If no vertices in a closed walk appears more than once then the closed walk is called circuit.
Examples: 𝑎 𝑏
3
4 11 10
𝑑
1 2 5 12 𝑐
9
6 8
7 𝑓
𝑒
Some 𝑎-𝑐 walk: 1𝑒2𝑎3𝑏12𝑓7𝑒6𝑑9𝑐 , 𝑎5𝑓12𝑏3𝑎411𝑏10𝑐 , 𝑐8𝑓5𝑎, 𝑎3𝑏10𝑐.
Some closed walk: 𝑎1𝑒7𝑓12𝑏11𝑑6𝑒2𝑎, 𝑑11𝑏10𝑐8𝑓7𝑒6𝑑, 𝑒2𝑎5𝑓8𝑐9𝑑4𝑎3𝑏12𝑓7𝑒.
Some 𝑎-𝑐 path: 𝑎1𝑒6𝑑9𝑐, 𝑎1𝑒7𝑓12𝑏11𝑑9𝑐, 𝑎4𝑑9𝑐, 𝑎2𝑒7𝑓8𝑐.
Some circuits: 𝑎1𝑒2𝑎, 𝑎1𝑒7𝑓8𝑐10𝑏3𝑎, 𝑎5𝑓12𝑏3𝑎.
Every circuit is a closed walk. Every path is a walk.
Theorem: Prove that a circuit graph, 𝐶𝑛 on 𝑛 vertices is bipartite if and only if 𝑛 is even.
Solution: Let 𝑣1 − 𝑣2 ‑𝑣3 ⋯ 𝑣𝑛 − 𝑣1 be a circuit graph 𝐶𝑛 on 𝑛 vertices. If 𝐶𝑛 is bipartite, then there exists a
partition of vertex set 𝑉 in to two subsets 𝑉1 and 𝑉2 such that there is no edge in 𝐶𝑛 between the vertices of V1
or between the vertices of V2 . Therefore, all the odd suffix vertices are in one vertex set and even suffix vertices
are in another vertex set. If n is odd then 𝑣𝑛 belongs to the same vertex set that contains 𝑣1 . Which is impossible
because 𝑣1 and 𝑣𝑛 are adjacent. Hence, 𝑛 is even.
Conversely, suppose 𝐶𝑛 : 𝑣1 ‑𝑣2 ‑𝑣3 ⋯ 𝑣𝑛 ‑𝑣1 be a circuit graph with n is even.
Clearly the set 𝑉1 = {𝑣1 , 𝑣3 , ⋯ 𝑣𝑛−1 } and 𝑉2 = {𝑣2 , 𝑣4 , ⋯ 𝑣𝑛 } form a partition of vertex set V such that each
edge in 𝐶𝑛 joins a vertex in V1 and a vertex in V2 . Therefore, 𝐶𝑛 is bipartite.
Prove that a connected Graph G is bipartite if and only if G contains no circuit of odd length.
Review questions: 1. Find the i) number of spanning subgraphs, ii) number of connected spanning subgraphs .
iii) Number of spanning subgraphs with 𝑎 as isolated vertex. iv) Induced subgraph 〈{𝑎, 𝑏, 𝑐, 𝑑}〉.
a
g e
h i
2. A null graph containing 3 vertices, how many subgraphs are there? How many spanning subgraphs are there?
3. Is every 𝑥-𝑦 walk is a 𝑥-𝑦 path?
4. Is every 𝑥-𝑥 closed walk is a 𝑥-𝑥 circuit?
5. Is the graph is spanning subgraph of itself?
Therefore if, 𝜅(𝐺 ) = 1, then graph is connected, and if 𝜅(𝐺 ) ≥ 2, then graph is disconnected.
Complete Graph (𝑲𝒏 ): Complete graph on n vertices is simple graph with one and only one edge between
every pair of vertices.
Examples: 𝑲𝟏 : 𝑲𝟐 : 𝑲𝟑 : 𝑲𝟒 :
Complement of a graph: Let 𝐺 be a simple graph on 𝑛 vertices. The complement of 𝐺 denoted by 𝐆 is the
subgraph of 𝐾𝑛 consisting of the 𝑛 vertices of 𝐺 and all edges of 𝐾𝑛 that are not in G.
Examples: 𝑮 : 𝐆∶
𝐾𝑛 is a complete graph and hence there is one and only one edge between any two vertices.
𝑛(𝑛−1)
Therefore, number of edges is number of selections of 2 vertices from n vertices ∴ 𝑒 = 𝑛𝑐2 = .
2
𝑛(𝑛−1)
Or, in 𝐾𝑛 every vertex is of degree (𝑛 − 1) .Therefore 2𝑒 = ∑ dig(𝑣) = 𝑛(𝑛 − 1) ∴ 𝑒 = .
2
In 𝐾𝑚,𝑛 , from each of m vertices of one vertex set there are n edges to the n vertices of another vertex set.
Therefore, number of edges in 𝐾𝑚,𝑛 is 𝑒 = 𝑚𝑛. and the number of vertices is 𝑚 + 𝑛.
2. Prove that a graph G is disconnected if and only if its vertex set V is partitioned into two nonempty subsets
𝑉1 and 𝑉2 such that there is no edge in G with one end vertex is in 𝑉1 and another end vertex is in 𝑉2 .
Proof: If such partition exists, then there is no path between the any vertex of 𝑉1 and each vertex of 𝑉2.
Hence, graph is disconnected.
Suppose the graph G is disconnected, then the graph contains at least two components. Take the set of
vertices of one component as the vertex set 𝑉1 and the set of remaining vertices as vertex set 𝑉2 .
Then there is no edge in G with one end vertex is in 𝑉1 and another end vertex is in 𝑉2 .
Proof: If G = (V, E) is not connected, then the vertex set V can be partitioned into at least two subsets V1, V2
such that there is no edge in E of the form {x, y} where x ∈ V1 and y ∈ V2. But the edge {x, y} is in 𝐺̅ for any
vertices x ∈ V1 and y ∈ V2.
To show 𝐺̅ is connected. Consider any two vertices 𝑎, 𝑏 of 𝐺̅ . If 𝑎 ∈ 𝑉1 and 𝑏 ∈ 𝑉2 or 𝑎 ∈ 𝑉2 and 𝑏 ∈ 𝑉1
then the edge {𝑎, 𝑏} is in 𝐺̅ , and hence there is a path in 𝐺̅ between 𝑎 and 𝑏.
If 𝑎 and 𝑏 both are in 𝑉1 (or in 𝑉2). Then {𝑎, 𝑐}, {𝑐, 𝑏} is 𝑎-𝑏 path in 𝐺̅ , where 𝑐 ∈ 𝑉2 (or 𝑐 ∈ 𝑉1).
Therefore 𝐺̅ is connected.
4. Define self-complimentary graph, give an example of 4 vertices and 5 vertices self-complimentary graph.
Solution: If the two edges are selected from all the edges incident on a vertex, we get a path of length 2.
There is one vertex of degree 4, four vertices of degree 3 and one vertex of degree 2.
Therefore, number of paths of length 2 = 4𝐶2 + 4 × 3𝐶2 + 2𝐶2 = 19.
7. If a graph (connected or disconnected) has exactly two vertices of odd degree, there must be a path joining
these two vertices.
Proof: Since the graph has only two vertices of odd degree, and number of odd degree vertices is always even,
both the odd degree vertices must be in one component of the graph. Each component is connected, and hence
there is at least one path between the two odd degree vertices.
(𝑛−𝑘)(𝑛−𝑘+1)
8. Prove that a simple graph with 𝑛 vertices and 𝑘 components can have at the most edges.
2
Proof: Let the number of vertices in each of the k components of a simple graph be 𝑛1 , 𝑛2 , 𝑛3 , ⋯ , 𝑛𝑘 .
Thus, 𝑛 = 𝑛1 + 𝑛2 + 𝑛3 + ⋯ ⋯ + 𝑛𝑘 with each 𝑛𝑖 ≥ 1 .
𝑛𝑖 (𝑛𝑖 −1)
The maximum number of edges in 𝑖th component is .
2
Therefore maximum number of edges in the graph is
1 1 𝑛 By the inequality
∑𝑘𝑖=1(𝑛𝑖2 − 𝑛𝑖 ) = ∑𝑘𝑖=1 𝑛𝑖2 −
2 2 2
1
≤ 2 [𝑛2 − (𝑘 − 1)(2𝑛 − 𝑘) − 𝑛] ∑𝑘𝑖=1 𝑛𝑖2 ≤ 𝑛2 − (𝑘 − 1)(2𝑛 − 𝑘)
1
= 2 [𝑛2 + 𝑛 − 2𝑛𝑘 + 𝑘 2 − 𝑘]
1
= 2 [(𝑛 − 𝑘) + (𝑛 − 𝑘)2 ]
(𝑛−𝑘)(𝑛−𝑘+1)
= 2
Therefore if graph is disconnected then it has at least two component, and hence maximum number of edges in
(𝑛−2)(𝑛−1) (𝑛−2)(𝑛−1)
the disconnected simple graph is . Therefore if a simple graph contains more than edges
2 2
then graph is connected
Review questions:
1. What is the compliment of 𝐾𝑛 ?
2. What is the compliment of null graph?
3. Whether the compliment of multigraph exists?
4. For what value of 𝑛, a complete graph is also bipartite graph?
5. Can a disconnected graph be a bipartite graph?
Electrical Network Problems: Properties (such as transfer function and input impedance) of an electrical
network are functions of only two factors:
1. The nature and value of the elements forming the network, such as resistors, inductors, transistors, and
so forth.
2. The way these elements are connected together, that is, the topology of the network.
Since there are only a few different types of electrical elements, the variations in networks are chiefly due to the
variations in topology. Thus, electrical network analysis and synthesis are mainly the study of network
topology. In the topological study of electrical networks, factor 2 is separated from 1 and is studied
independently.
The topology of a network is studied by means of its graph. In drawing a graph of an electrical network the
junctions are represented by vertices, and branches (which consist of electrical elements) are represented by
edges, regardless of the nature and size of the electrical elements.
Example: 𝑏 𝑏
𝑎 𝑐 𝑎 𝑐
𝑒 𝑒
𝑑
𝑑
Electrical network. Graph of electrical network.
Seating Problem: Nine members of a new club meet each day for lunch at a round table. They decide to sit
such that every member has different neighbors at each lunch. How many days can this arrangement last? This
situation can be represented by a graph with nine vertices such that each vertex represents a member, and an
edge joining two vertices represents the relationship of sitting next to each other. Then each arrangement is a
circuit containing all the vertices. Hence the solution to the seating problem is to find the number of edge
disjoint circuits containing all the vertices in a complete graph 𝐾9 .
A PUZZLE WITH MULTICOLORED CUBES: We are given four cubes. The six faces of every cube are
variously colored blue, green, red, or white. Is it possible to stack the cubes one on top of another to form a
column such that no color appears twice on any of the four sides of this column?
Problem can be solved by using graphs. Two steps are involved here: First, the physical problem is converted
into a problem of graph theory. Second, the graph-theory problem is then solved.
Interested students can solve this problem. Cubes are available in the department.