CSC 10400 Discrete Mathematical Structures Lecture 11

CSC 10400
Discrete Mathematical Structures
Lecture 11
Instructor: Pavel Rytir
Email: rytirpavel@gmail.com
The City College of New York
Spring 2015
Section 11.1 Graph: Definitions and Examples
Graph
Multigraph
Graph
Directed graph
Let V be a finite nonempty set and let E ⊆ V × V . The pair
(V , E ) is called a directed graph. Here V is the set of
vertices, or nodes, called the vertex set; and E is its set of
edges or arcs, called the edge set. We write G = (V , E ) to
denote such a graph.
A directed graph has at least one vertex.
A directed graph may have no edge.
There is at most one edge from one vertex to another vertex.
There are at most two edges between two vertices (one of each
direction).
Graph
Directed graph
Let V be a finite nonempty set and let E ⊆ V × V . The pair
(V , E ) is called a directed graph. Here V is the set of
vertices, or nodes, called the vertex set; and E is its set of
edges or arcs, called the edge set. We write G = (V , E ) to
denote such a graph.
A directed graph has at least one vertex.
A directed graph may have no edge.
There is at most one edge from one vertex to another vertex.
There are at most two edges between two vertices (one of each
direction).
Undirected graph
If there is no concern about the direction of any edge, the
graph is an undirected graph.
Edges in an undirected graph have no direction.
There is at most one edge between two vertices.
Examples of Undirected Graph and Directed Graph
(a) Directed Graph
(b) Undirected Graph
Direction of Edges in Directed Graph
Let G = (V , E ) be a directed graph. Let u, v ∈ V be two vertices
in the graph, and let (u, v ) be an edge from u to v .
The direction of (u, v ) is from u to v .
u is adjacent to v , and v is adjacent from u.
u is the origin or source of the edge (u, v ); and v is the
terminus, or destination of the edge (u, v ).
Direction of Edges in Directed Graph
Let G = (V , E ) be a directed graph. Let u, v ∈ V be two vertices
in the graph, and let (u, v ) be an edge from u to v .
The direction of (u, v ) is from u to v .
u is adjacent to v , and v is adjacent from u.
u is the origin or source of the edge (u, v ); and v is the
terminus, or destination of the edge (u, v ).
a is adjacent to b, and b is
adjecent from a.
a is the source of (a, b), and
b is the destination of (a, b).
More on Vertices and Edges in graphs
Suppose that (u, v ) is an edge in a graph (undirected or
directed).
The edge (u, v ) is incident with the vertices u and v .
The vertices u and v are incident with the edge (u, v ).
The vertices u and v are adjacent. In the other word, u and v
are neighbors.
More on Vertices and Edges in graphs
Suppose that (u, v ) is an edge in a graph (undirected or
directed).
The edge (u, v ) is incident with the vertices u and v .
The vertices u and v are incident with the edge (u, v ).
The vertices u and v are adjacent. In the other word, u and v
are neighbors.
An edge (u, u) is a loop.
More on Vertices and Edges in graphs
Suppose that (u, v ) is an edge in a graph (undirected or
directed).
The edge (u, v ) is incident with the vertices u and v .
The vertices u and v are incident with the edge (u, v ).
The vertices u and v are adjacent. In the other word, u and v
are neighbors.
An edge (u, u) is a loop.
An vertex having no incident edge is called an isolated vertex.
More on Vertices and Edges in graphs
Suppose that (u, v ) is an edge in a graph (undirected or
directed).
The edge (u, v ) is incident with the vertices u and v .
The vertices u and v are incident with the edge (u, v ).
The vertices u and v are adjacent. In the other word, u and v
are neighbors.
An edge (u, u) is a loop.
An vertex having no incident edge is called an isolated vertex.
An graph having no loop is called loop-free.
More on Vertices and Edges in graphs
Suppose that (u, v ) is an edge in a graph (undirected or
directed).
The edge (u, v ) is incident with the vertices u and v .
The vertices u and v are incident with the edge (u, v ).
The vertices u and v are adjacent. In the other word, u and v
are neighbors.
An edge (u, u) is a loop.
An vertex having no incident edge is called an isolated vertex.
An graph having no loop is called loop-free.
if not specified, a graph is assumed to be undirected and
loop-free.
Examples
The edge (a, b) is incident
with a and b.
The vertices a and b are
incident with (a, b).
The vertices a and b are
adjacent, or neighbors.
The edge (a, b) is incident
with a and b.
The vertices a and b are
incident with (a, b).
(a, a) is a loop.
The vertices a and b are
adjacent, or neighbors.
e is an isolated vertex.
This graph is loop-free.
Walk
Let G = (V , E ) be an undirected graph and let u, w be two
vertices in the graph.
A walk from u to w is a finite sequence
v0 = u, e1 , v1 , . . . , vn−1 , en , vn = w of vertices and edges in G ,
starting at u and ending at w and involing the edges
ei = (vi−1 , vi ), where 1 ≤ i ≤ n.
In the other word, one can walk from u to w following the
given walk.
The vertex u and w could be the same vertex.
The length of this walk is n, i.e., the number of edges in the
walk. The number of vertices in the walk is its length plus 1.
Walk
Let G = (V , E ) be an undirected graph and let u, w be two
vertices in the graph.
A walk from u to w is a finite sequence
v0 = u, e1 , v1 , . . . , vn−1 , en , vn = w of vertices and edges in G ,
starting at u and ending at w and involing the edges
ei = (vi−1 , vi ), where 1 ≤ i ≤ n.
In the other word, one can walk from u to w following the
given walk.
The vertex u and w could be the same vertex.
The length of this walk is n, i.e., the number of edges in the
walk. The number of vertices in the walk is its length plus 1.
For a walk from u to w , if u = w , this walk is a closed walk;
otherwise, it is an open walk.
Trail
Consider a walk from u to w in a graph G = (V , E ).
If no edge in this walk is repeated, this walk is a trail.
Trail
Consider a walk from u to w in a graph G = (V , E ).
If no edge in this walk is repeated, this walk is a trail.
If a trail is closed, this trail is a circuit.
Trail
Consider a walk from u to w in a graph G = (V , E ).
If no edge in this walk is repeated, this walk is a trail.
If a trail is closed, this trail is a circuit.
If no vertex in this walk is repeated, this walk is a path.
FA path is always a trail.
Trail
Consider a walk from u to w in a graph G = (V , E ).
If no edge in this walk is repeated, this walk is a trail.
If a trail is closed, this trail is a circuit.
If no vertex in this walk is repeated, this walk is a path.
FA path is always a trail.
If a path is closed, this path is a cycle.
Trail
Consider a walk from u to w in a graph G = (V , E ).
If no edge in this walk is repeated, this walk is a trail.
If a trail is closed, this trail is a circuit.
If no vertex in this walk is repeated, this walk is a path.
FA path is always a trail.
If a path is closed, this path is a cycle.
We can define such terms on directed graph, e.g., directed
walks, directed paths, and directed cycles.
Examples
a→e→f →a→d →e→a→
b is a walk, but it is not a trail
because (a, e) is used twice.
a → e → f → a → d → e → a is a
closed walk, but it is not a circuit
because (a, e) is used twice.
a → e → f → a → b is a trail, but
it is not a path because the vertex
a is used twice.
a → e → f → a → b → c → a is a
circuit, by it is not a cycle because
the vertex a is used twice.
a → e → f is a path.
a → e → f → a is a cycle.
Summaries on Walks, Trails, and Paths
Walk
Closed walk
Trail
Circuit
Path
Cycle
Must
be
closed
No
Yes
No
Yes
No
Yes
Allow
repeated
edges
Yes
Yes
No
No
No
No
Allow
repeated
vertices
Yes
Yes
Yes
Yes
No
No
Theorem
Let G = (V , E ) be a graph and let u, v be vertices in G with u 6= v .
If there exists a trail from u to v , then there is a path from u to v .
Theorem
Let G = (V , E ) be a graph and let u, v be vertices in G with u 6= v .
If there exists a trail from u to v , then there is a path from u to v .
Proof.
Consider a trail from u to v . If it contains no repeated vertex, it is
a path. If it contains a repeated vertex, say w , we can locate the
first occurrence and the second occurence of w in this trail. By
shortcutting the edges between the two occurences, we obtain a
shorter trail. We can continue this shortcut until it is a path.
Connected Graphs
Connected graph
A graph is connected if there is a path between any two
distinct vertices in G . If a graph is not connected, it is
disconnected.
Connected Graphs
Connected graph
A graph is connected if there is a path between any two
distinct vertices in G . If a graph is not connected, it is
disconnected.
Connectivity on directed graph.
A directed graph is connected, or weakly connected, if the
correpsonding undirected graph (obtained by ignoring the
directions of edges) is connected. A directed graph is strongly
connected if there is a directed path from any two vertices in
the graph.
Connected Graphs
Connected graph
A graph is connected if there is a path between any two
distinct vertices in G . If a graph is not connected, it is
disconnected.
Connectivity on directed graph.
A directed graph is connected, or weakly connected, if the
correpsonding undirected graph (obtained by ignoring the
directions of edges) is connected. A directed graph is strongly
connected if there is a directed path from any two vertices in
the graph.
Components
The number of components in a graph G is denoted by K(G ).
Examples
(a) Disconnected undirected graph
(b) Connected undirected graph
(c)
Disconnected (d) Weakly connected (e) Strongly connected
directed graph
directed graph
directed graph
Multigraph
A multigraph is a generalization of a graph, in which there are two
or more edges between some vertices u and v . A directed
multipgraph is defined similarly.
Section 11.2 Subgraphs, Complements and Graph
Isomorphism
Subgraph
Complete graph and complements
Graph isomorphism
Subgraph
Subgraph
If G = (V , E ) is a graph (directed or undirected), then
G1 = (V1 , E1 ) is a subgraph of G if ∅ =
6 V1 ⊆ V and E1 ⊆ E ,
where edge edge in E1 is incident with vertices in V1 .
Figure: G1 and G2 are subgraphs of G .
Spanning Subgraph
Spanning subgraph
Let G = (V , E ) be a graph and G1 = (V1 , E1 ) be a subgraph
of G . If V1 = V , G1 is a spanning subgraph of G .
(a) G1 and G2 are not spanning
subgraph of G
(b) G3 and G4 are spanning subgraph of G
Induced Subgraph
Subgraph induced by vertices
Let G = (V , E ) be a graph and ∅ =
6 V1 ⊂ V , the subgraph of
G induced by V1 is the subgraph whose vertex set is V1 and
which contains all edges from G incident to vertices in V1 .
Subgraph G − u.
Let u be a vertex in G = (V , E ). A graph denoted by G − u
is the subgraph induced by the vertex set V1 = V − {u}, i.e.,
the set of all vertices in G except u. Similarly, we can define
the subgraph G − e where e is an edge.
Complete Graph
Complete graph
Let V be a set of n vertices. The complete graph on V ,
denoted by Kn , is a loop-free undirected graph, in which there
exists an edge between every two distinct vertices.
Complement Graph
Complement
Let G be a loop-free undirected graph of n vertices. The
complement of G , denoted by G , is the subgraph of Kn
consisting of n vertices in G and all edges that are not in G .
Graph Isomorphisms
Let G1 = (V1 , E1 ) and G2 = (V2 , E2 ) be two undirected graphs. A
function f : V1 → V2 is called a graph isomorphism if
f is bijective.
For any u, v ∈ V1 , (u, v ) ∈ E1 if and only if (f (a), f (b)) ∈ E2 .
When such a function exists, G1 and G2 are isomorphic graphs.
Two graphs are isomorphic means they have the same
topology.
Section 11.3 Vertex Degree: Euler Trail and Circuit
Vertex degree
Regular graph
Euler trail and Euler circuit
Vertex Degrees
Let G be an undirected graph (or multigraph), and let v be a
vertex of G . The degree of v , denoted by deg (v ), is the number of
edges incident with v . Here a loop at v is considered as two
incident edges for v .
deg (a) = 3.
deg (b) = 2.
deg (c) = 4.
deg (d) = 2.
deg (e) = 0.
deg (f ) = 2.
deg (g ) = 2.
deg (h) = 1.
Theorem
P
Let G = (V , E ) be a graph, then v ∈V deg (v ) = 2|E |.
Theorem
P
Let G = (V , E ) be a graph, then v ∈V deg (v ) = 2|E |.
Proof.
Consider an edge (a, b) ∈ E . It contributes one degree at a and
one degree at b. Thus, the total number of degrees over all
vertices is exactly 2|E |.
Theorem
P
Let G = (V , E ) be a graph, then v ∈V deg (v ) = 2|E |.
Proof.
Consider an edge (a, b) ∈ E . It contributes one degree at a and
one degree at b. Thus, the total number of degrees over all
vertices is exactly 2|E |.
Corollary
The number of vertices of odd degree must be even.
k-regular Graph
Let G = (V , E ) be a graph. If each vertex in G has the same
degree, G is called a regular graph. If deg (v ) = k for all vertices v ,
then G is called k-regular.
The Seven Bridges of K¨onigsberg
During the eighteenth century, the city of K¨
onigsberg was divided
into four sections by a river. Seven bridges connected these
regions. Can one find a way to walk around the city to cross all
bridges exactly once and then return to the staring point?
Euler Circuit
Let G = (V , E ) be a graph (or multigraph) with no isolated
vertices. G has an Euler circuit if there is a circuit in G that
traverses every edge of the graph exactly once. If there is a trail
from u to w in G traversing each edge exactly once, this trail is an
Euler trail.
An Euler circuit for K5 is:
a → b → c → d → e → a → d → b → e → c → a.
Theorem
Let G = (V , E ) be a graph (or multigraph) with no isolated vertices.
G has an Euler circuit if and only if G is connected and every vertex
in G has even degree.
Theorem
Let G = (V , E ) be a graph (or multigraph) with no isolated vertices.
G has an Euler circuit if and only if G is connected and every vertex
in G has even degree.
Corollary
Let G = (V , E ) be a graph (or multigraph) with no isolated vertices.
G has an Euler trail if and only if G is connected and has exactly
two vertices of odd degree.
Incoming Degrees and Outgoing Degrees
Let G = (V , E ) be a directed graph. For each v ∈ V .
The incoming degree of v , denoted by id(v ), is the number of
edges in G whose terminus is v .
The outgoing degree of v , denoted by od(v ), is the number of
edges in G whose origin is v .
id(a) = 1, od(a) = 3.
id(b) = 1, od(b) = 1.
id(c) = 1, od(c) = 0.
id(d) = 1, od(d) = 0.
id(e) = 0, od(e) = 0.
Theorem
X
v ∈V
id(v ) =
X
od(v )
v ∈V
Proof.
Because each directed edge contributes one incoming degree at its
destination and one outgoing degree at its source, the above
equation is valid.
Theorem
Let G = (V , E ) be a directed graph (or directed multigraph) with
no isolated vertices. The graph has a directed Euler circuit if and
only if G is connected and id(v ) = od(v ) for all v ∈ V .
Section 11.4 Planar Graphs
Planar graph
Bipartite graph
Kuratowski’s theorem
Euler’s theorem on planar graphs
Planar Graph
A graph G is called planar if G can be drawn in the plane with its
edges do not intersect in their interiors. Such a drawing of G is
called an embedding of G in the plane.
Bipartite Graph
A graph G = (V , E ) is bipartite if V = V1 ∪ V2 with V1 ∩ V2 = ∅,
and every edge of G connects a vertex in V1 and a vertex in V2 .
A complete bipartite graph is a bipartite graph such that there is
an edge between every pair of vertices u ∈ V1 and v ∈ V2 . If
|V1 | = m and |V2 | = n, then the complete bipartite graph is
denoted by Km,n .
FIn the other word, a bipartite graph only contains edges
connecting vertices in two disjoint partition of vertices in G .
Kuratowski’s Theorem
Theorem
A graph is nonplanar if and only if it contains a subgraph that is
homomorphic to either K5 and K3,3 .
A graph homomorphism function could be not bijective.
A graph isomorphism function is a bijective graph
homomorphism function.
Some Specific Graphs
(c) K5
(d) K3,3
(e) Petersen graph
Euler’s Theorem on Planar Graph
Theorem
Let G = (V , E ) be a connected planar graph with |V | = v and
|E | = e. Let f be the number of regions in the plane determined by
a planar embedding of G , called faces (one face is a infinite region).
Then v − e + f = 2.
Euler’s Theorem on Planar Graph
Theorem
Let G = (V , E ) be a connected planar graph with |V | = v and
|E | = e. Let f be the number of regions in the plane determined by
a planar embedding of G , called faces (one face is a infinite region).
Then v − e + f = 2.
Corollary
Let G = (V , E ) be a loop-free connected planar graph with |V | = v
and |E | = e > 2, and f faces. Then 3f ≤ 2e and e ≤ 3v − 6.
Problem
Prove that K5 and K3,3 not planar.
Answer
Problem
Prove that K5 and K3,3 not planar.
Answer
The graph K5 has 10 edges and 5 vertices. Thus,
3v − 6 = 15 − 6 = 9 < 10 = e. By Euler’s theorem, K5 is not
planar.
Problem
Prove that K5 and K3,3 not planar.
Answer
The graph K5 has 10 edges and 5 vertices. Thus,
3v − 6 = 15 − 6 = 9 < 10 = e. By Euler’s theorem, K5 is not
planar.
The graph K3,3 has 9 edges and 6 vertices. However,
3v − 6 = 12 > 9 = e. Thus, we need to prove it using another
result of Euler’s theorem. Because each region in the graph is
bounded by at least 4 edges, we have 4f ≤ 2e. From Euler’s
theorem, we have v − e + f = 2, or
f = e − v + 2 = 9 − 6 + 2 = 5, so 20 = 4r ≤ 2e = 18, a
contradiction. Therefore, K3,3 is not planar.
Section 11.5 Hamilton Paths and Cycles
Hamilton cycle
Hamilton path
Hamilton Cycle and Hamilton Path
Hamilton cycle
Let G = (V , E ) be a graph with |V | ≥ 3. A Hamilton cycle is
a cycle in G that contains every vertex in V .
FIf G has a Hamilton cycle, one can departs from any vertex
in G , follows the cycle, visits every vertex in G exactly once,
and returns back to the starting vertex.
Hamilton Cycle and Hamilton Path
Hamilton cycle
Let G = (V , E ) be a graph with |V | ≥ 3. A Hamilton cycle is
a cycle in G that contains every vertex in V .
FIf G has a Hamilton cycle, one can departs from any vertex
in G , follows the cycle, visits every vertex in G exactly once,
and returns back to the starting vertex.
Hamilton path
A Hamilton path is a path (not a cycle) in G that contains
each vertex.
A Hamilton cycle is
a → b → c → d → e → a.
A Hamilton path is
a → b → c → e → d.
Determining the Existence of Hamilton Cycle is Very Hard
A few hints can help you for small graphs.
If G has a Hamilton cycle, then for all v ∈ V , deg (v ) ≥ 2.
Determining the Existence of Hamilton Cycle is Very Hard
A few hints can help you for small graphs.
If G has a Hamilton cycle, then for all v ∈ V , deg (v ) ≥ 2.
If v ∈ V and deg (v ) = 2, then the two edges incident with v
must appear in every Hamilton cycle.
Determining the Existence of Hamilton Cycle is Very Hard
A few hints can help you for small graphs.
If G has a Hamilton cycle, then for all v ∈ V , deg (v ) ≥ 2.
If v ∈ V and deg (v ) = 2, then the two edges incident with v
must appear in every Hamilton cycle.
If v ∈ V and deg (v ) > 2, as we try to build a Hamilton cycle,
once we pass through v , any unused edge incident with v can
be deleted from further consideration.
Determining the Existence of Hamilton Cycle is Very Hard
A few hints can help you for small graphs.
If G has a Hamilton cycle, then for all v ∈ V , deg (v ) ≥ 2.
If v ∈ V and deg (v ) = 2, then the two edges incident with v
must appear in every Hamilton cycle.
If v ∈ V and deg (v ) > 2, as we try to build a Hamilton cycle,
once we pass through v , any unused edge incident with v can
be deleted from further consideration.
In building a Hamilton cycle for G , we cannot obtain a cycle
for a subgraph of G unless it contains all the vertices of G .
Section 11.6 Graph Coloring and Chromatic Polynomials
Graph Coloring
Four Color Problem
Proper Coloring
Proper coloring
Let G = (V , E ) be a graph, a proper coloring of G occurs
when we color the vertices of G so that the vertices incident
to each edge are colored differently. Namely, if (u, v ) is an
edge, then u and v are colored by different colors.
Chromatic Number
Chromatic number
The mininum number of colors needed to properly color G is
called the chromatic number, denoted by X (G ).
X (K2 ) = 2.
X (K3 ) = 3.
X (Kn ) = n.
X (K2,3 ) = 2.
X (Km,n ) = 2.
If G is the Petersen graph, X (G ) = 3.
Four Color Problem
Four Color Problem
Give a map, can you use four colors to color countries in the map
so that two incident countries have different colors?
Four Color Problem
Four Color Problem
Give a map, can you use four colors to color countries in the map
so that two incident countries have different colors?
It is first introduced by Francis Guthrie in 1850.
It was solve in 1976 by Kenneth Appel and Wolfgang Haken.
The answer is YES!
They proved it using computer, analyzing 1936 different case.
It is the first mathematical theorem proved by using computer.