Slide 11 - graphs

advertisement
Discrete Structures
CMSC 250
Lecture 1
January 28, 2008
CMSC 250
1
Chapter 10, Graph Theory
CMSC 250
2
Definitions

The formal definition of graph G is 2 finite sets:
– V(G) = a set of vertices
– E(G) = a set of edges

Example:
– V(H) = {a,b,c,d,e} E(H) = {{a,c},{c,e},{e,b},{b,d},{d,a}}
– V(K) = {a,b,c,d} E(K)= {(a,b),(b,a),(a,d),(d,a),(c,c)}

Subgraph: H is a subgraph of G iff V(H)  V(G) and
E(H)  E(G)
CMSC 250
3
Graph isomorphism
G
is isomorphic to H iff there exists a
bijective function f1:(V(G))  V(H) and a
bijective function f2:(E(G))  E(H)
CMSC 250
4
Variations of graphs






CMSC 250
The edges of a digraph are ordered tuples.
The edge list of a multigraph is a multiset (bag), not a set.
A simple graph has no parallel edges and no loops (reflexive edges).
In a connected graph any vertex is reachable from any other one.
A complete graph has an edge between every pair of vertices.
A complete bipartite graph has two subsets of vertices (u and v), an
edge from each vertex in u to each vertex in v, and no edges
connecting any vertices in v to others in v, or connecting any vertices in
u to others in u.
5
Counting in graphs

Number of edges possible
– complete (simple) graph
– complete bipartite graph

Degree of a vertex
n( E ( K x )) 
x 1
i
i 1
n( E ( K x, y ))  x * y
= number of times that vertex is the endpoint of an edge
= number of edges incident on it with self-loops counted twice
CMSC 250
6
Traversing a Graph
Name
Repeated Edges
Repeated
Verticies
Same end/start
Walk
allowed
allowed
allowed
Path
NO
allowed
allowed
Simple Path
NO
NO
NO
Closed Walk
allowed
allowed
YES
Circuit
NO
allowed
YES
Simple Circuit
NO
only the start/end
YES
CMSC 250
7
Euler circuit

A circuit that contains every edge and every vertex
– starts and stops at the same point
– uses every vertex at least once
– uses every edge exactly once

G has an Euler circuit iff G is a connected graph and
every vertex of G has even degree
CMSC 250
8
Hamiltonian circuit
•A simple circuit that contains every vertex.
–starts and stops at the same point
–uses every vertex exactly once (except the first and last)
–does not repeat an edge
CMSC 250
9
How hard are these problems?

Finding a Hamiltonian circuit is thought to be a hard
problem.

How does it compare with the problem discussed in
the first lecture of finding a satisfying assignment for
the variables of a Boolean formula?
CMSC 250
10
Download