5.2 Graph Theory
5.2 Graph Theory
1. Complete Graphs –
• A complete graph on n vertices, denoted by Kn, is the simple graph that contains exactly
one edge between each pair of distinct vertices.
• Every node is connected to all other nodes. Degree of any node= n-1
• In this above figure all the graphs K1, K2, K3, K4, K5, K6 are complete graphs.
• No. of edges of Kn = n(n-1)/2. Sum of 1+2+....+(n-1)
3. Wheels –
• A wheel Wn is obtained by adding an additional vertex to a cycle Cn for n ≥ 3 and
connecting this new vertex to each of the n vertices in Cn by new edges.
• Cycle with one additional vertex that is adjacent to all other.
5. Bipartite Graphs –
• A simple graph G is bipartite if V can be partitioned into two disjoint subsets V1 and V2
such that every edge connects a vertex in V1 and a vertex in V2. In other words, there are
no edges which connect two vertices in V1 or in V2.
• In short-
o It consists of two sets of vertices V1 and V2.
o The vertices of set V1 join only with the vertices of set V2.
o The vertices within the same set do not join.
• To determine whether a given graph is bipartite or not, coloring alternate vertex with the
same color may be applied. If number of color used is 2, then Bipartite
• Here,
o The vertices of the graph can be decomposed into two sets.
o The two sets are V1 = {A, C} and V2 = {B, D}.
o The vertices of set V1 join only with the vertices of set V2 and vice-versa.
o The vertices within the same set do not join.
o Therefore, it is a bipartite graph.
• Here,
o This graph is a bipartite graph as well as a complete graph.
o Therefore, it is a complete bipartite graph.
o This graph is represented as K4,3.
o No. of edges in complete bipartite graph, Km,n = m*n.
6. Planar Graph –
• In graph theory, planar graph is a graph that can be drawn in a plane such that none of its
edges cross each other i.e. plane without intersecting or overlapping edges.
• Here,
o In this graph, no two edges cross each other.
o Therefore, it is a planar graph.
S => Star
8. Euler Graph –
• Any connected graph is called as a Euler Graph if and only if all its vertices are of even
degree.
• In other word, an Euler Graph is a connected graph that contains an Euler Circuit. An
Euler circuit is a circuit that uses every edge of a graph exactly once.
• There exist one closed walk consisting of all vertices in the graph.
• Here,
o This graph is a connected graph and all its vertices are of even degree. Therefore,
it is an Euler graph.
o Alternatively, the above graph contains an Euler circuit BACEDCB, so it is an
Euler graph.
9. Hamiltonian Circuit –
• A closed walk that traverse every vertex of a graph exactly once, except of the starting
and ending vertices. which is the same point
• Here,
o AEHDCGFBA → Hamiltonian Circuit.
o ADCGHEFBA → Hamiltonian Circuit.
10. Graph Representation –
• Adjacency Lists:
o A table with 1 row per vertex, listing its adjacent vertices.
• Adjacency Matrix:
o The elements of the matrix indicate whether pairs of vertices are adjacent or not in
the graph.
1 - are adjacent
0 - aren't adjacent
A B C D E
A 0 1 0 0 1
B 1 0 1 0 1
C 0 1 0 1 0
D 0 0 1 0 1
E 1 1 0 1 0
❖ Rooted Trees
1
Level 0
• Parent-child: 1-2, 1-3, 1-4, …
• Ancestor of 16 : 13, 6, 3, 1
2 3 4 Level 1 • Root: 1; Taken to have no
ancestors;
• Descendent of 4: 9, 10, 14, 15
5 6 10 Level 2
7 8 9 • Descendent of 1: 2-17
= • Siblings: 2, 3, 4; 6, 7, 8; 9, 10;
11 Level 3 …
13
12 14 15
Level 4
16 17
▪ Leaves; Internal vertices; Branching factor: 3; Binary trees; Ordered (left to right) Children or
subtrees.
❖ Spanning Trees
• V(S2) = V(S1),
E(S2) E(S1) and S2 is a tree
6) Bipartite Graphs
Example 1:
Say, a, b, c – students; B, E, M, S, H – courses.
Each student takes every course.
3+5 = 8 vertices
• A partition of V contains 2 sets, where no
two elements of the same set are adjacent to
each other.
• K3,5 : Complete bipartite; |E| = (5x3+3x5)/2 =
3x5.
• To determine whether a given graph is
bipartite or not, coloring alternate vertex
with the same color may be applied.
Example 2:
3 concentric rectangles, having the corners of
one connected to the corresponding corners of
inner rectangles.
• After coloring, it is found that a partition of V
contains 2 sets, where no two elements of
the same set are adjacent to each other.
• Bipartite, but not complete.
7) Regular graphs
P2 / T2 C3 / K3 C4 K4 K2,2 K3,3 …
8) Planar graphs
Examples:
• Tetrahedron – 4 faces, including an infinite face
• Cube – 6 faces
• C3 – 2 faces
• Any tree – 1 face
✓ Can be drawn on a 2-D plane with crossing at a vertex only.
✓ Euler’s formula for planar graphs: e = v+f-2
9) Eulerian Graphs
✓ Eulerian circuit / cycle: Round tour / trail / walk that takes every edge once, and visits all the
vertices.
o Degree of each vertex needs to be even.
✓ Semi-Eulerian: The circuit is not complete, although each edge taken.