Chapter 8

advertisement
CSCI 115
Chapter 8
Topics in Graph Theory
CSCI 115
§8.1
Graphs
§8.1 – Graphs
• Graph
– A graph G consists of a finite set of vertices V,
a finite set of edges E, and a function γ that
assigns a subset of vertices {v, w} to each edge
(v may equal w)
– If e is an edge, and γ(e) = {v, w} we say e is the
edge between v & w, and that v & w are the
endpoints of e
§8.1 – Graphs
• Terminology
– Degree of a vertex
• Number of edges having that vertex as an endpoint
– Loop
• Edge from a vertex to itself
• Contributes 2 to the degree of a vertex
– Isolated vertex
• Vertex with degree 0
– Adjacent vertices
• Vertices that share an edge
§8.1 – Graphs
•
Path
–
A path  in a graph G consists of a pair of
sequences (V, E), V: v1, v2, …, vk and
E: e1, e2, …, ek–1 s.t.:
1. γ(ei) = {vi, vi+1} i
2. ei  ej  i, j
§8.1 – Graphs
• More terminology
– Circuit
• Path that begins and ends at the same vertex
– Simple path
• No vertex appears more than once (except possibly
the first and last)
– Simple circuit
• Simple path where first and last vertices are equal
§8.1 – Graphs
• Special types of graphs
– Connected graph
•  path from every vertex to every other (different)
vertex
– Disconnected graph
• There are at least 2 vertices which do not have a path
between them
• components
– Regular Graph
• All vertices have the same degree
§8.1 – Graphs
• Special families of graphs (n  Z+)
– Un: The discrete graph on n vertices
• The graph with n vertices and no edges
– Kn: The complete graph on n vertices
• The graph with n vertices, and an edge between
every pair of vertices
– Ln: The linear graph on n vertices
• The graph with n vertices and edges {vi, vi+1}
 i  {1, 2, …, n – 1}
§8.1 – Graphs
• Subgraphs
– If G = (V, E, γ) and E1  E, V1  V s.t. V1
contains (at least) all of the end points of edges
in E1, then H = (V1, E1, γ) is a subgraph of G
– If G = (V, E, γ) and e  E, then Ge is the
subgraph found by deleting e from G and
keeping all vertices
§8.1 – Graphs
• Quotient graphs
– If G = (V, E, γ) and R is an equivalence relation
on V, then GR is the quotient graph found by
merging all vertices within the same
equivalence classes.
CSCI 115
§8.2
Euler Paths and Circuits
§8.2 – Euler Paths and Circuits
• A path in a graph G is an Euler path if it
includes every edge exactly once
• An Euler circuit is an Euler path that is also
a circuit
§8.2 – Euler Paths and Circuits
•
Theorem 8.2.1
1. If G has a vertex of odd degree, there can be no Euler
circuit of G
2. If G is a connected graph and every vertex has even
degree then there is an Euler circuit in G
•
Theorem 8.2.2
1. If a graph G has more than 2 vertices of odd degree,
there can be no Euler path in G
2. If G is connected and has exactly 2 vertices of odd
degree, then there exists an Euler path in G. Any
Euler path must begin at one vertex of odd degree,
and end at the other.
§8.2 – Euler Paths and Circuits
•
Theorem 8.2.1 and 8.2.2
–
•
Existence theorems
Bridge
–
A bridge is an edge in a connected graph that
if removed would result in a disconnected
graph
§8.2 – Euler Paths and Circuits
Fleury’s Algorithm for finding an Euler
circuit for a connected graph where every
vertex has even degree (let G = V, E, γ)
1.
Select and edge e1 of G with vertices (v1, v2) that is not a bridge.
Let  be (V: v1, v2, E: e1). Remove e1 from E and v1 and v2
from V to create G1.
2. Suppose V: v1, v2, …, vk and E: e1, e2, …, ek–1 have been
constructed to form Gk–1. Select ek in Gk–1 that has vk as a vertex
and is not a bridge in Gk–1 (discounting vk). Extend V to v1, v2,
…, vk, vk+1 and E to e1, e2, …, ek–1, ek.
3.
Repeat step 2 until no edges remain in E.
CSCI 115
§8.3
Hamiltonian Paths and Circuits
§8.3 – Hamiltonian Paths and
Circuits
• A Hamiltonian path is a path that contains
each vertex exactly once
• A Hamiltonian circuit is a Hamiltonian path
that is also a circuit
§8.3 – Hamiltonian Paths and
Circuits
• Theorem 8.3.1
– Let G be a connected graph with n vertices
(n  Z, n  2), with no loops or multiple edges.
G has a Hamiltonian circuit if for any 2 vertices
u and v of G that are not adjacent, the degree of
u plus the degree of v is  n.
• Corollary 8.3.1
– G has a Hamiltonian circuit if each vertex has
degree  (n/2).
§8.3 – Hamiltonian Paths and
Circuits
• Theorem 8.3.2
– Let the number of edges of G be m. Then G has
a Hamiltonian circuit if m  ½(n2 – 3n + 6)
where n is the number of vertices.
Download