Graph Theory
Graph Theory
Graph Theory
Definition:
An (undirected) graph G is defined by two finite sets, there exist a non-
void set X of elements called vertices, a set E (which can be empty) of
elements called edges.
For each edge “e”, there are two associated vertices, x and y, distinct or
not, called the endvertices of e.
(A vertex of a graph is the fundamental unit of which graphs are formed. They
are also called nodes and appear as points when drawn. An edge is an object
that connects or links two vertices of a graph)
Notation:
We write G = (X, E). The sets X and E can be denoted by X(G) and E(G).
The cardinality of X, that is the number of vertices, is usually denoted by n
or nG.
The cardinality of E, that is, the number of edges, is denoted by m or m G.
The pair of endvertices of an edge e is simply denoted by xy (or yx), when
x≠y
Representation:
A graph and its representation.
The vertices are represented by dots and the edges by simple lines
connecting two endvertices.
Edge a is associated with the endvertices x and z.
Edge b is also associated x and z.
Edge c is associated with x and y.
Edge d is associated with z and y.
Finally, edge e is associated twice with the vertex y (this is the case for a
loop)
Open Walk If a walk has different start and end vertex. (Start≠End)
Closed Walk If a walk has same start and end vertex. (Start=End)
Note: Walks, paths, trails, circuits and cycles do not need to use every edge or every
vertex in the graph.
4) Planner Graph
A graph G= (V, E) is said to be planar if it can be drawn in the plane so that no
two edges of G intersect at a point other than a vertex. Such a drawing of a
planar graph is called a planar embedding of the graph.
5) Bipartite Graph
A graph G = (V, E) is said to be a bipartite graph if its vertex set V(G) can
be partitioned into two non-empty disjoint subsets.
V1(G) and V2(G) in such a way that each edge e of E(G) has one end in
V1(G) and another end in V2(G).
The partition V1 U V2 = V is called Bipartite of G.
Example: Here in the figure: V1(G)={V5, V4, V3} and V2(G)={V1, V2}
6) Degree
Prove
• Proof. When adding up the vertex degrees of G, each edge is counted twice,
once for each end. The result is thus twice the number of edges of the graph.
7) Cut Vertex
A single vertex whose removal disconnects a graph is called a cut-vertex.
8) Define Tree. Also write down its properties.
A tree is a connected acyclic graph, where acyclic means without a cycle.
A tree is a simple graph (a loop or a double edge would define a cycle).
In general, n denotes the number of vertices of a tree and m the number
of edges.
Properties of a Tree
A tree such that n ≥2 has at least two vertices of degree one.
If G is a tree then m = n−1.
In a tree any two vertices are connected by a unique path.
*Proof of m=n-1
Apply inductive reasoning to n.
For n = 1, we have m = 0 since an edge could only be a loop, i.e. a cycle, which
is impossible for a tree.
Assume n > 1.
Since there is a vertex of degree one in G, given x.
The subgraph G − x is connected since suppressing a vertex of degree one in a
connected graph does not suppress the connectedness property, as is easily
verified.
In addition, G−x is acyclic because a cycle in G − x would also be a cycle of G,
while G, as a tree, is itself acyclic.
Thus G = G − x is a tree and it is possible to apply the induction hypothesis,
which gives:
mG = nG − 1.
As mG = mG − 1 and nG = nG − 1,
we can deduce the desired equality:
mG = nG − 1.
Tree Characteristics
The following conditions for a graph G are equivalent:
G is a tree.
G is connected and m = n−1.
G is acyclic and m = n−1.
G is connected and every edge is a bridge.
In G any two given vertices are linked by a unique path.
10)Block decomposition
A block of a graph G is a maximal induced connected subgraph without a cut
vertex (of itself as a graph).
11)K-Connectivity
the minimum number of vertices whose removal makes G disconnects or
reduces to a trivial graph. It is denoted by K(G).
K(G)=1
12)Edge Connectivity
The edge connectivity of a connected graph G is the minimum number of edges
whose removal makes G disconnected. It is denoted by K’(G).
K’(G1)=1, K’(G2)=2, K’(G3)=3
Here are the following four ways to disconnect the graph by removing two edges:
CHAPTER 3
CHAPTER 4
Notation:
We write G = (X, A). Sets X and A may also be denoted by X(G) and A(G).
As in the undirected case, the notations nG or n for the number of vertices
and mG or m for the number of arcs.
Vertex y is called a successor of x and vertex x is called a predecessor of
y.
Representation:
Digraphs are drawn in a plane as graphs, with simply an arrow indicating its
orientation on each arc line, the arrow going from x to y if the ordered pair (x, y)
is associated with it.
A digraph:
o the arc a is associated with the ordered pair (x, z),
o b with the ordered pair (z, x),
o c with the ordered pair (x, y),
o d with the ordered pair (z, y),
o e with the ordered pair (y, y);
Chapter 5
Breadth First Search (BFS) algorithm traverses a graph in a breadth-ward motion and
uses a queue to remember to get the next vertex to start a search when a dead end
occurs in any iteration.
BFS is basically a node-based algorithm which is used to find the shortest path in the
graph between two nodes. BFS moves through all of its nodes which are connected to
the individual nodes.
BFS uses the FIFO (First In First Out) principle while using the Queue to find the
shortest path. However, BFS is slower and requires a large memory space.
Depth First Search (DFS) algorithm traverses a graph in a depth-ward motion and
uses a stack to remember to get the next vertex to start a search when a dead-end
occurs in any iteration.
DFS uses LIFO (Last In First Out) principle while using Stack to find the shortest path.
DFS is also called Edge Based Traversal because it explores the nodes along the edge
or path. DFS is faster and requires less memory. DFS is best suited for decision trees.
CHAPTER 6
DIJKSTRA’S ALGORITHM
An algorithm that is used for finding the shortest distance, or path, from starting
node to target node in a weighted graph is known as Dijkstra’s Algorithm.
This algorithm makes a tree of the shortest path from the starting node, the
source, to all other nodes (points) in the graph.
CHAPTER 7
Note: If a graph has an odd number of vertices, it, of course, cannot have a perfect
matching
Alternating Path:
Given a graph G = (X, E) and a matching M of G, “a path for which the edges are
alternately in M and in E \ M ” is called an alternating path relative to M, or an M-
alternating path,
Augmenting Path:
An M-alternating path is said to be an augmenting path for M, or an M-augmenting
path, if its endvertices are M-unsaturated.
Berge Theorem: A matching M of a graph G is maximum if and only if there is no
M-augmenting path.
CHAPTER 8
Define Transportation Network.
A transportation network R is defined as:
A strict connected digraph G = (X, A) with two disjoint sets, S ⊆ X (the set of the
sources) and T ⊆ X (the set of the sinks), and a weighting of the arcs, c : A → N
(natural numbers), called the capacity. We will also allow the (positive) value ∞ as
the capacity of an arc.
Note:
1) A connected graph G is Eulerian if and only if every vertex has an even degree.
2) A connected graph has a Euler trail if and only if the number of its vertices of
odd degree is ≤ 2)
Chapter 10
Hamilton Path: a path going through all the vertices of a graph
Hamilton Cycle: A Hamilton cycle of a graph G is a cycle going through all the vertices
of the graph. Because it is a cycle, it will only go through each vertex once (counting
only once the first and last vertex, which is the same vertex since it is a cycle).
(3) shortening of the preceding sequence and Hamilton cycle C obtained, of value
78
Christofide’s algorithm
Steps:
1) Draw min spanning tree
2) Find out odd vertices
3) Connect odd vertices (make two sets) directly
4) Draw that connectivity into already found min spanning tree
5) Then we will get two or three cycles
6) Write down their path
7) Cut or remove repearing vertex from path
8) Remaining path will be drawn as cycle