DMS Unit v GraphTheory
DMS Unit v GraphTheory
The key to Euler’s solution was in a very simple abstraction of the puzzle. Let us redraw our diagram of the city of K
̈onigsberg by representing each of the land masses as a vertex and representing each bridge as an edge connecting the vertices
corresponding to the land masses. We now have a graph that encodes the necessary information. The problem reduces to
finding a ”closed walk” in the graph which traverses each edge exactly once, this is called an Eulerian circuit. Does such a
circuit exist?
RV College of
Engineering UNIT-I Go, Change the World
Definition 1. A graph is an ordered triple (V(G), E(G),IG), where V(G) is a nonempty set ,E(G) is a set disjoint
from V(G) , and IG is an “incidence ”relation that associates with each element of E(G) an unordered pair of
elements(same or distinct) of V(G). Elements of V(G) are called the vertices (or nodes or points) of G, and
elements of E(G) are called the edges (or lines) of G. V(G) and E(G) are the vertex set and edge set of G,
respectively. If, for the edge e of G, IG(e)={u, v}, we write IG(e)=uv.
Example 1. If V(G)={v1, v2, v3, v4, v5}, E(G)={e1, e2, e3, e4, e5, e6} and I G is given by IG(e1)={v1, v5},
IG(e2)={v2, v3), IG(e3)={v2, v4}, IG(e4)={v2, v5)}, IG(e5)={v2, v5}, IG(e6)={v3, v3}, then (V(G), E(G), IG) is a
graph.
Diagrammatic Representation of a Graph. Each graph can be represented by a diagram in the plane. In this
diagram, each vertex of the graph is represented by a point, with distinct vertices being represented by distinct
points. Each edge is represented by a simple “Jordan” arc joining two (not necessarily distinct) vertices. The
diagrammatic representation of a graph aids in visualizing many concepts related to graphs and the systems of
which they are models. In a diagrammatic representation of a graph, it is possible that two edges intersect at a point
that is not necessarily a vertex of the graph.
RV College of
Engineering UNIT-I Go, Change the World
Example 2. In the graph of Fig.1., edge e3 =v2v4, edges e4 and e5 form multiple edges, e6 is a loop at v3,
N(v2)= {v3, v4, v5 }, N(v3) = {v2}}, N[v2 ]= {v2,v3, v4,v5}, and N[v2 ]= N(v2) U {v2}. Further, v2 and v5 are adjacent vertices and e3 and
e4 are adjacent edges.
Definition 3. A graph is called finite if both V(G) and E(G) are finite. A graph that is not finite is called an infinite graph.
Unless otherwise stated, all graphs considered in this course are finite. Throughout the course, we denote by n(G) and m(G)
the number of vertices and edges of the graph G respectively. The number n(G) is called the order of G and m(G) is the size
of G. When explicit reference to the graph G is not needed, V(G), E(G), n(G), and m(G) will be denoted simply by V, E, n, and
m respectively.
RV College of
Engineering UNIT-I Go, Change the World
Definition 2. If IG (e)={u,v}, then the vertices u and v are called the end vertices or ends of the edge e.
Each edge is said to join its ends, in this case, we say that e is incident with each one of its ends. Also, the vertices u and v
are then incident with e.
A set of two or more edges of a graph G is called a set of multiple or parallel edges if they have the same pair of distinct
ends. If e is an edge with end vertices u and v, we write e= uv.
An edge for which the two ends are the same is called a loop at the common vertex.
A vertex u is a neighbor of v in G, if uv is an edge of G, and u ≠ v. The set of all neighbors of v is the open neighborhood of
v or the neighbor set of v, and is denoted by N(v), the set N[v]= N(v) U {v} is the closed neighborhood of v in G.
Vertices u and v are adjacent to each other in G if and only if there is an edge of G with u and v as its ends. Two distinct
edges e and f are said to be adjacent if and only if they have a common end vertex.
A graph is simple if it has no loops and no multiple edges. Thus, for a simple graph G, the incidence function I G is one-to-
one. Hence, an edge of a simple graph is identified with the pair of its ends. A simple graph therefore may be considered as
an ordered pair (V(G), E(G)), where V(G) is a nonempty set and E(G) is a set of unordered pairs of elements of V(G) (each
edge of the graph being identified with the pair of its ends).
RV College of
Engineering UNIT-I Go, Change the World
Example 2. In the graph of Fig(1), edge e3 = v2v4;, edges e4 and e5 form multiple edges, e6 is a loop at v3, N(v2)={v3,v4,v5},
N(v3)= {v2}, N[v2 ]= {v2,v3,v4,v5} and N[v2 ]= N(v2 ) U {v2}. Further, v2 and v5 are adjacent vertices and e3 and e4 are adjacent
edges.
Definition 3. A graph is called finite if both V(G) and E(G) are finite. A graph that is not finite is called an infinite graph.
Unless otherwise stated, all graphs considered are finite. Throughout this course, we denote by n(G) and m(G) the number of
vertices and edges of the graph G, respectively. The number n(G) is called the order of G and m(G) is the size of G. When
explicit reference to the graph G is not needed, V(G), E(G), n(G), and m(G) will be denoted simply by V, E, n, and m,
respectively.
Figure (2) is a graph with loops and multiple edges, while Fig (3) represents a simple graph.
Definition 4. A graph is said to be labeled if its n vertices are distinguished from one another by labels such as v1;v2;:::;vn
In Fig(4) the graph G is labeled and the graph H is not labeled.
RV College of
Engineering UNIT-I Go, Change the World
RV College of
Engineering UNIT-I Go, Change the World
RV College of
Engineering UNIT-I Go, Change the World
RV College of
Engineering UNIT-I Go, Change the World
Graph Isomorphism: A graph can exist in different forms having the same number of vertices, edges, and also the
same edge connectivity. Such graphs are called isomorphic graphs. Note that we label the graphs in this chapter mainly for the
purpose of referring to them and recognizing them from one another.
Isomorphic Graphs
Two graphs G1 and G2 are said to be isomorphic if −
•Their number of components (vertices and edges) are same.
•Their edge connectivity is retained.
There exists a function ‘f’ from vertices of G 1 to vertices of G2 [f: V(G1) ⇒ V(G2)], such that
Case (i): f is a bijection (both one-one and onto)
Case (ii): f preserves adjacency of vertices, i.e., if the edge {U, V} ∈ G 1, then the edge {f(U), f(V)} ∈ G2, then G1 ≡ G2.
Note
If G1 ≡ G2 then −
|V(G1)| = |V(G2)|
|E(G1)| = |E(G2)|
Degree sequences of G1 and G2 are same.
If the vertices {V1, V2, .. Vk} form a cycle of length K in G1, then the vertices {f(V1), f(V2),… f(Vk)} should form a cycle of
length K in G2.
All the above conditions are necessary for the graphs G 1 and G2 to be isomorphic, but not sufficient to prove that the graphs are
RV College of
Engineering UNIT-I Go, Change the World
RV College of
Engineering UNIT-I Go, Change the World
RV College of
Engineering UNIT-I Go, Change the World
Fundamental Definitions
A cycle is a simple graph whose vertices can be cyclically ordered so that two vertices are adjacent if and only if they are
consecutive in the cyclic ordering.
We usually think of paths and cycles as subgraphs within some larger graph. A subgraph H of a graph G, is a graph such that
V (H) ⊆ V (G) and E(H) ⊆ E(G) satisfying the property that for every e ∈ E(H), where e has endpoints u, v ∈ V (G) in the
graph G, then u, v ∈ V (H) and e has endpoints u, v in H, i.e. the edge relation in H is the same as in G.
A graph G is connected if for every u, v V (G) there exists a u, v-path in G. Otherwise G is called disconnected. The maximal
connected subgraphs of G are called its components.
A walk is a list v0, e1, v1, . . . , ek, vk of vertices and edges such that for 1 ≤ I ≤ k, the edge ei has endpoints vi−1 and vi.
A trail is a walk with no repeated edge. A u, v-walk or u, v-trail has first vertex u and last vertex v. When the first and last
vertex of a walk or trail are the same, we say that they are closed. A closed trail is called a circuit.
A path is a simple graph whose vertices can be ordered so that two vertices are adjacent if and only if they are consecutive
in the ordering. A path which begins at vertex u and ends at vertex v is called a u, v-path.
RV College of
Engineering UNIT-I Go, Change the World
With this new terminology, we can consider paths and cycles not just as subgraphs, but also as ordered lists of vertices and
edges. From this point of view, a path is a trail with no repeated vertex, and a cycle is a closed trail (circuit) with no repeated
vertex other than the first vertex equals the last vertex.
Alternatively, we could consider the sub graph traced out by a walk or trail.
vertex, and in a multigraph, loops are counted twice.[1] The degree of a vertex is denoted deg(v).
The maximum degree of a graph, denoted by ∆(G), and the minimum degree of a graph, denoted by δ(G), are the
maximum and minimum degree of its vertices.
In the graph gelow, the maximum degree is 5 and the minimum degree is 0.
In a regular graph, every vertex has the same degree, and so we can speak of the degree of the graph. A
complete graph (denoted Kn , where n is the number of vertices in the graph) is a special kind of regular graph
where all vertices have the maximum degree.
The degree sum formula states that, given a graph G=(V,E), ∑deg(v)=2|E|.
The formula implies that in any undirected graph, the number of vertices with odd degree is even. This statement
(as well as the degree sum formula) is known as the handshaking lemma. The latter name comes from a popular
mathematical problem, which is to prove that in any group of people, the number of people who have shaken
hands with an odd number of other people from the group is even.
RV College of
Go, Change the World
Degree sequence
Engineering
The degree sequence of an undirected graph is the non-increasing sequence of its vertex degrees, for the below graph
it is (5, 3, 3, 2, 2, 1, 0).
The degree sequence is a graph invariant so isomorphic graphs have the same degree sequence. However, the degree
sequence does not, in general, uniquely identify a graph; in some cases, non-isomorphic graphs have the same degree
sequence.
Two non-isomorphic graphs with the same degree sequence (3, 2, 2, 2, 2, 1, 1, 1).
RV College of
Engineering Go, Change the World
A directed graph is a set of vertices (nodes) connected by edges, with each node having a direction associated with it. In
the example fig (1) below, the graph can be traversed from vertex a to b, but not from vertex b to a.
Let us look at the same graph again and determine the number of
its edges and the sum of the degrees of all its vertices:
i h
d
a e
g
b c f j
Result: There are 9 edges, and the sum of all degrees is 18. This is
easy to explain: Each new edge increases the sum of degrees by
exactly two.
RV College of
Engineering Go, Change the World
Example: How many edges are there in a graph with 10 vertices, each
of degree 6?
Solution: The sum of the degrees of the vertices is 610 = 60.
According to the Handshaking Theorem, it follows that 2e = 60, so
there are 30 edges.
RV College of
Engineering Go, Change the World
Question: How does adding a loop to a vertex change the in-degree and out-
degree of that vertex?
Answer: It increases both the in-degree and the out-degree by one.
RV College of
Engineering Go, Change the World
deg-(b) = 4
deg (a) = 1
-
a deg+(b) = 2
deg+(a) = 2 b
deg-(d) = 2
deg-(c) = 0
deg+(d) = 1 d c deg+(c) = 2
RV College of
Engineering Go, Change the World
This is easy to see, because every new edge increases both the sum of in-
degrees and the sum of out-degrees by one.
RV College of
Special Graphs
Engineering Go, Change the World
Definition: The Null graph on n vertices is the simple graph that contains
exactly n vertices and no edges.
Example:
Special Graphs
Engineering Go, Change the World
K1 K2 K3 K4 K5
RV College of
Special Graphs
Engineering Go, Change the World
Definition: The cycle Cn, n 3, consists of n vertices v1, v2, …, vn and edges {v1,
v2}, {v2, v3}, …, {vn-1, vn}, {vn, v1}.
C3 C4 C5 C6
RV College of
Special Graphs
Engineering Go, Change the World
W3 W4 W5 W6
RV College of
Special Graphs
Engineering Go, Change the World
Definition: The n-cube, denoted by Qn, is the graph that has vertices
representing the 2n bit strings of length n. Two vertices are adjacent if and only
if the bit strings that they represent differ in exactly one bit position.
110 111
10 11 100 101
010 011
0 1
00 01 000 001
Q1 Q2 Q3
Special Graphs
RV College of
Engineering Go, Change the World
Special Graphs
Engineering Go, Change the World
Example I: Is C3 bipartite?
v1 No, because there is no way to partition the vertices into two sets so that there are no
edges with both endpoints in the same set.
v2 v3
v3 v4
v3 v4
RV College of
Special Graphs
Engineering Go, Change the World
Definition: The complete bipartite graph Km,n is the graph that has its vertex set
partitioned into two subsets of m and n vertices, respectively. Two vertices are
connected if and only if they are in different subsets.
K3,2 K3,4
RV College of
Go, Change the World
Operations on Graphs
Engineering
K5 subgraph of K5
RV College of
Go, Change the World
Operations on Graphs
Engineering
G1 G2 G1 G2 = K5
Operations on Graphs
RV College of
Engineering Go, Change the World
Definition: The Intersection of two simple graphs G1 =(V1, E1) and G2 = (V2, E2) is
the simple graph with vertex set V1 ∩ V2 and edge set E1 ∩ E2.
Example : The Intersection of G and H is denoted by G ∩ H.
Operations on Graphs
RV College of
Engineering Go, Change the World
Definition: The Disjoint Union of two or more simple graphs G1 =(V1, E1)
and G2 = (V2, E2) is the simple graph with vertex set V1 U V2 and edge set
E1 U E2, and V1 ∩ V2 =Ø and edge set E1 ∩ E2= Ø.
Example:
Operations on Graphs
RV College of
Engineering Go, Change the World
Definition: The Join of two simple graphs G1 =(V1, E1) and G2 = (V2, E2) is
the simple graph with vertex set V1 U V2 and edge set E1 U E2, and from
each vertex belongs to V1 add an edge to each vertex belongs to V2.
Example:
Operations on Graphs
RV College of
Engineering Go, Change the World
Definitions:
A graph H is called a sub graph of G if V(H) V(G) and E(H) E(G).
If H is a sub graph of G, then G is said to be a super graph of H.
A sub graph H of a graph G is a proper sub graph of G if either V(H) ≠V(G)
or E(H) ≠ E(G).
A sub graph H of G is said to be an induced sub graph of G if each edge of G
having its ends in V(H) is also an edge of H.
A sub graph H of G is a spanning sub graph of G if V(H)= V(G).
RV College of
Engineering Go, Change the World
RV College of
Go, Change the World
Engineering
Graph representations
RV College of
Go, Change the World
Engineering
Graph representations
2
1 3
1 1 1 2 2 3 5 5 5 7 7
2 5 6 7 3 4 6 7 4 4
4
6
5
RV College of
Go, Change the World
Engineering
Graph representations
• disadvantages
• hard to tell if an edge
exists from A to B
• hard to tell how many edges
a vertex touches (its degree)
1 1 1 2 2 3 5 5 5 7
2 5 6 7 3 4 6 7 4 4
RV College of
Go, Change the World
Engineering
Graph representations
Adjacency Matrix
• adjacency matrix: an n × n matrix where:
• the nondiagonal entry aij is the number of edges joining
vertex i and vertex j (or the weight of the edge joining vertex i
and vertex j)
• the diagonal entry aii corresponds to the number of loops
(self-connecting edges) at vertex i
RV College of
Go, Change the World
Engineering
Graph representations
• disadvantages
• consumes a lot of memory on sparse
graphs (ones with few edges)
• redundant information for undirected
graphs
RV College of
Go, Change the World
Engineering
Graph representations
Adjacency Matrix Example
• How do we figure out the degree of a given
vertex?
• How do we find out whether an edge exists
from A to B?
• How
1 2 could
3 4 5 we
6 7 look for loops in the graph? 2
1 0 1 0 0 1 1 0 1 3
2 1 0 1 0 0 0 1
3
4
0 1 0 1 0 0 0 7
0 0 1 0 1 0 1
5
1 0 0 1 0 1 1 4
6
7 1 0 0 0 1 0 0 6
0 1 0 1 1 0 0 5
RV College of
Go, Change the World
Engineering
Graph representations
Adjacency Lists
• adjacency list: stores edges as individual linked lists of
references to each vertex's neighbors
RV College of
Go, Change the World
Engineering
Graph representations
n vertices, m edges
Edge Adjacency Adjacency
no parallel edges
List List Matrix
no self-loops
Space n+m n+m n2
Finding all adjacent
m deg(v) n
vertices to v
Determining if v is
m deg(v) 1
adjacent to w
adding a vertex 1 1 n2
adding an edge to v 1 1 1
removing vertex v m n? n2
removing an edge from
m deg(v) 1
v
RV College of
Go, Change the World
Engineering
Graph representations
3500
2000
Houston
RV College of
Engineering
Adjacency matrix for weighted Go, Change the World
undirected graph
Example 1:
A
B C D E
F G
RV College of
Go, Change the World
Engineering
Trees
What is a tree?
• Connected acyclic graph is called as tree.
• Trees are structures used to represent hierarchical relationship
• Each tree consists of nodes and edges
• Each node represents an object
• Each edge represents the relationship between two nodes.
node
edge
66
RV College of
Go, Change the World
Engineering
Trees
President
+
VP VP
Personnel Marketing * 5
3 2
Director Director
Customer Sales
Relation
RV College of
Engineering Go, Change the World
Terminology I
root
u
u: parent of v
v: child of u
v
leaves
68
RV College of
Engineering Go, Change the World
Terminology II
• In a tree, the nodes without children are called leaves. Otherwise, they are called internal nodes.
internal nodes
leaves
RV College of
Engineering Go, Change the World
Terminology III
• If two nodes have the same parent, they are siblings.
• A node u is an ancestor of v if u is parent of v or parent of parent of v or
…
• A node v is a descendent of u if v is child of v or child of child of v or …
Terminology IV
T
A subtree of T
v v
RV College of
Engineering Go, Change the World
Terminology V
• Level of a node n: number of nodes on the path from root to node n
• Height of a tree: maximum level among all of its node
Level 1
Level 2
height=4
n Level 3
Level 4
Binary Tree
RV College of
Engineering Go, Change the World
x: left child of u
u v y: right child of u
w: right child of v
x y z: left child of w
w
z
Full binary tree
RV College of
Engineering Go, Change the World
Level 1: 20 nodes
Level 2: 21 nodes
Level 3: 22 nodes
Tree Traversal
RV College of
Engineering Go, Change the World
• Given a binary tree, we may like to do some operations on all nodes in a binary tree. For
example, we may want to double the value in every node in a binary tree.
• To do this, we need a traversal algorithm which visits every node in the binary tree.
RV College of
Engineering Go, Change the World
• By pre-order, (prefix)
+*23/84
• By in-order, (infix) +
2*3+8/4
• By post-order, (postfix) * /
23*84/+
2 3 8 4
• By level-order,
+*/2384
• Note 1: Infix is what we read!
• Note 2: Postfix expression can be computed efficiently using stack
RV College of
Go, Change the World
Engineering
Trees
1. A simple graph is a tree if and only if any two distinct vertices are connected by a unique path.
2. Every connected graph contains a spanning tree.
3. The number of edges in a tree on n vertices is n-1. Conversely, a connected graph on n vertices and n-1 edges
is a tree.
4. A tree with at least two vertices contains at least two pendant vertices (i.e., end vertices or vertices of degree 1).
6. A connected graph G with at least two vertices is a tree if and only if its degree sequence{d1,d2,…,dn} satisfies the
condition: i=1 n di=2(n-1) with di >0 for each i.
7.If u and v are non adjacent vertices of a tree T, then T+ uv contains a unique cycle.
8. Every tree has a center consisting of either a single vertex or two adjacent vertices.
RV College of
Go, Change the World
Engineering
Trees
Definitions: Let G be a connected graph.
1. The diameter of G is defined as max{d(u,v) : u,v Ɛ V(G) and is denoted by diam(G).
2. If v is a vertex of G, its eccentricity e(v) is defined by e(v)= max {d(v, u) : u Ɛ V(G).
3. The radius r(G) of G is the minimum eccentricity of G: that is, r(G)= min{e(v) : v Ɛ V(G).
4. A vertex v of G is called a central vertex if e(v)= r(G). The set of central vertices of G is called the center of G.
RV College of
Go, Change the World
Engineering
Trees
1. A branch at a vertex u of a tree T is a maximal sub tree containing u as an end vertex. Hence the number of branches
at u is deg(u).
2. The weight of a vertex u of T is the maximum number of edges in any branch at u.
3. A vertex v is a centroid vertex of T if v has minimum weight.
The set of all centroid vertices is called the centroid of T .
RV College of
Engineering Counting the Number of Spanning Trees Go, Change the World
Counting the number of spanning trees in a graph occurs as a natural problem in many branches of science. Spanning
trees were used by Kirchoff to generate a“cycle basis” for the cycles in the graphs of electrical networks.
The number of spanning trees of a connected labeled graph G will be denoted by Ʈ(G). If G is disconnected, we take
Ʈ(G)=0.
There is a recursive formula for (G). Before establish this formula, let us define the concept of edge contraction in graphs.
Definition: An edge e of a graph G is said to be contracted if it is deleted from G and its ends are identified. The resulting
graph is denoted by G o e. Edge contraction is illustrated in Fig. below. If e is not a loop of G, then n(G o e)= n(G)-1,
m(G o e)= m(G)-1.
Example 3: How many spanning trees are there for the graph G below?
RV College of
Engineering Counting the Number of Spanning Trees Go, Change the World
RV College of
Engineering Minimum Cost Spanning Trees Go, Change the World
Kruskal's algorithm to find the minimum cost spanning tree uses the greedy approach.
This algorithm treats the graph as a forest and every node it has as an individual tree. A tree connects to another only
and only if, it has the least cost among all available options and does not violate MST properties.
Step 1 - Remove all loops and Parallel Edges Remove all loops and parallel edges from the given graph.
In case of parallel edges, keep the one which has the least cost associated and remove all others.
RV College of
Engineering Minimum Cost Spanning Trees Go, Change the World
The least cost is 2 and edges involved are B,D and D,T. We add them. Adding them does not violate spanning tree properties, so
we continue to our next edge selection.
Next cost is 3, and associated edges are A,C and C,D. We add them again −
We observe that edges with cost 5 and 6 also create circuits. We ignore them and move on.
We ignore it. In the process we shall ignore/avoid all edges that create a circuit.
RV College of
Engineering Minimum Cost Spanning Trees Go, Change the World
By adding edge S,A we have included all the nodes of the graph and we now have minimum cost spanning tree.
Now we are left with only one node to be added. Between the two least cost edges available 7 and 8, we shall add the edge with cost 7.
RV College of
Engineering Minimum Cost Spanning Trees Go, Change the World
RV College of
Engineering Minimum Cost Spanning Trees Go, Change the World
Prim's algorithm to find minimum cost spanning tree (as Kruskal's algorithm) uses the greedy approach. Prim's
algorithm shares a similarity with the shortest path first algorithms.
Prim's algorithm, in contrast with Kruskal's algorithm, treats the nodes as a single tree and keeps on adding new nodes
to the spanning tree from the given graph.
To contrast with Kruskal's algorithm and to understand Prim's algorithm better, we shall use the same example −
RV College of
Engineering Minimum Cost Spanning Trees Go, Change the World
Remove all loops and parallel edges from the given graph. In case of parallel edges, keep the one which has the least
cost associated and remove all others.
RV College of
Engineering Minimum Cost Spanning Trees Go, Change the World
Step 3 - Check outgoing edges and select the one with less cost
Now, the tree S-7-A is treated as one node and we check for all edges going out from it. We select the one which has the
lowest cost and include it in the tree.
RV College of
Engineering Minimum Cost Spanning Trees Go, Change the World
After this step, S-7-A-3-C tree is formed. Now we'll again treat it as a node and will check all the edges again. However, we will
choose only the least cost edge. In this case, C-3-D is the new edge, which is less than other edges' cost 8, 6, 4, etc.
RV College of
Engineering Minimum Cost Spanning Trees Go, Change the World
After adding node D to the spanning tree, we now have two edges going out of it having the same cost, i.e. D-2-T and D-2-B.
Thus, we can add either one. But the next step will again yield edge 2 as the least cost. Hence, we are showing a spanning
tree with both edges included.
We may find that the output spanning tree of the same graph using two different algorithms is same.
RV College of
Go, Change the World
Engineering
Eulerian and Hamiltonian Graphs
Euler Trails and Circuits
C
c
D
A
a d
B
b
RV College of
Go, Change the World
Engineering
Eulerian and Hamiltonian Graphs
a b a b a b
e e
d c d c c d e
yes no no
(a, e, c, d, e, b, a)
RV College of
Engineering Go, Change the World
Example
a b a b a b
e e
d c d c c d e
yes no yes
(a, e, c, d, e, b, a ) (a, c, d, e, b, d, a, b)
RV College of
Engineering Go, Change the World
NO (a, g, c, b, g, e, d, f, a) NO
RV College of
Engineering Go, Change the World
NO (a, g, c, b, g, e, d, f, a) (c, a, b, c, d, b)
RV College of
Engineering Go, Change the World
Hamilton Circuits
Is there a cycle in this graph that passes through each vertex exactly once?
RV College of
Engineering Go, Change the World
Hamilton Circuits
Yes; this has a cycle that passes through each vertex exactly once.
RV College of
Engineering Go, Change the World
A Sufficient Condition
Graphs
Definition:
A graph that can be drawn in the plane without any of its edges
intersecting is called a planar graph. A graph that is so drawn in the
plane is also said to be embedded in the plane.
Applications:
circuit layout problems
RV College of
Engineering Go, Change the World
Definition:
A planar graph G that is drawn in the plane
so that no two edges intersect (that is, G is embedded in the plane) is called a plane graph.
Definition:
Let G be a plane graph. The connected pieces of the plane that remain when the vertices and edges of G are
removed are called the regions of G.
G1
R3: exterior
R1
R2 G1 has 3 regions.
RV College of
Engineering Go, Change the World
Definition:
Every plane graph has exactly one unbounded region, called the exterior region. The vertices and edges of G that
are incident with a region R form a sub graph of G called the boundary of R.
G2
Fig 2
Boundary of R1:
v1 v2
G3 v1 v2
R1 v3
v3 Boundary of R5:
v5 v4 R5 v1 v2
v6 R2 v7
v3
R3 v5 v4
v8 v9
R4 v6 v7
G3 has 5 regions.
v9
RV College of
Engineering Go, Change the World
Observe:
(1) Each cycle edge belongs to the boundary
of two regions.
(2) Each bridge is on the boundary of only one region.
(exterior)
RV College of
Go, Change the World
Thm 1: (Euler’s Formula)
Engineering
p- k+r=2
#
RV College of
Engineering Go, Change the World
We obtainG
2 G1
by adding an edge at one of from the
verticesGof .
1
Proof of Euler’s Formula (cont’d)
RV College of
Engineering Go, Change the World
Gn from
In general, we can obtain Gn 1 by addingnan th edge to
one of theG
vertices
n 1 of .
• The new edge might link two vertices already
Ginn 1 .
• Or, the new edge might add another vertexGto
n 1 .
Then, adding (x,y) implies that x is also added, but that no new regions are formed
(no existing regions are split).
x rn rn 1
y
en en 1 1
K
vn vn 1 1
Corollary
• If G is a connected planar graph with e > 1, then e ≤ 3v – 6
• Proof:
• Define the degree of a region as the number of edges on its boundary. If an edge
occurs twice along the boundary, then count it twice. The region K has degree 12.
K
RV College of
Engineering Go, Change the World
2
Since 2e = (degrees of r), we know that 2e 3r e r
3
Also, we know r =e - v 2 from Euler's Formula.
Substitute Euler's Formula in to get:
2
e e v 2
3
1
=> 0 ( e v 2) *3
3
=> 0 e - 3v 6
=> e 3v - 6
RV College of
Engineering Go, Change the World
(a) (b)
RV College of
Engineering Go, Change the World
Definition:
A plane graph G is called maximal planar if, for every pair u, v of nonadjacent
vertices of G, the graph G+uv is nonplanar.
q = 3p - 6.
pf:
Embed the graph G in the plane, resulting in
p - q + r = 2.
r regions.
Since the boundary of every region of G is a
triangle, every edge lies on the boundary of
two regions.
| {the edges of the boundary of R} | 3r 2q
region R
p - q + 2q / 3 = 2.
q = 3p - 6
RV College of
Go, Change the World
Cor. 2(a): If G is a maximal planar bipartite graph with p 3 vertices and q edges, then q = 2p - 4.
Engineering
K5 K3,3
RV College of
Engineering Go, Change the World
Definition:
A subdivision of a graph G is a graph obtained by inserting vertices (of degree 2) into the edges of G.
RV College of
Engineering Go, Change the World
Subdivisions of graphs.
H
G
H is a subdivision of G.
F is not a subdivision of G.
-
RV College of
Engineering Go, Change the World
4 5 6
10 7
4 5 6
2 3
8 9
Example: 1
RV College of
Engineering Go, Change the World
Dual of a planar graph
Example: 2
RV College of
Go, Change the World
Engineering
Graph Coloring
Vertex Colorings
So we ask: What is the minimum number of rooms required to store all the
chemicals so that in each room only compatible chemicals are stored?
We convert the above storage problem into a problem in graphs. Form a graph
G=(V, E) by making V correspond bijectively to the set of available chemicals
and making u adjacent to v if and only if the chemicals corresponding to u and v
are incompatible. Then, any set of compatible chemicals correspond to a set of
independent vertices of G: Thus, a safe storing of chemicals corresponds to a
partition of V into independent subsets of G: The cardinality of such a minimum
partition of V is then the required number of rooms. The minimum cardinality is
called the chromatic number of the graph G.
RV College of
Go, Change the World
Engineering
Graph Coloring
Now color the edges of G so that no two adjacent edges receive the same color.
Then the edges in a particular color class, that is, the edges in that color, form a
matching in G and correspond to a schedule of work for a particular period.
Hence, the minimum number of periods required is the minimum number of
colors in an edge coloring of G in which adjacent edges receive distinct colors,
in other words, it is the edgechromatic number of G.
RV College of
Go, Change the World
Engineering
Graph Coloring
Definition 5: The minimum k for which a loop less graph G has a proper k-
edge coloring is called the edge-chromatic number or chromatic index of G:
It is denoted by χ’(.G).
G is k-edge-chromatic if χ’(.G)=k.
RV College of
Go, Change the World
Engineering
Graph Coloring
// χ’(G)=Δ(G)
Chromatic Polynomials
For a graph G and a given set of λ colors, the function f(G, λ) is defined to be
the number of ways of (vertex) coloring G properly using the λ colors. Hence,
f(G, λ)= 0 when G has no proper λ -coloring. Clearly, the minimum for which
f(G, λ) > 0 is the chromatic number χ (G) of G.
Theorem : Let G be any graph. Then f(G, λ)= f(G-e, λ) – f(Goe, λ) for
any edge e of G.
RV College of
Go, Change the World
Engineering
Graph Coloring
Proof: f(G-e, λ) denotes the number of proper colorings of G-e using λ colors.
Hence, it is the sum of the number of proper colorings of G-e in which u and
v receive the same color and the number of proper colorings of G-e in which
u and v receive distinct colors. The former number is f(Goe, λ), and the latter
number is f(G, λ)
If G and H are disjoint graphs, then f(G U H, λ)= f(G, λ)f(H, λ).
RV College of
Go, Change the World
Engineering
Graph Coloring
RV College of
Go, Change the World
Engineering
Graph Coloring