Beruflich Dokumente
Kultur Dokumente
Learning Outcomes
Students should be able to:
Explain basic terminology of a graph
Identify Euler and Hamiltonian cycle
Represent graphs using adjacency matrices
Contents
Introduction
Paths and circuits
Matrix representations of graphs
Introduction to Graphs
DEF: A simple graph G = (V,E ) consists
of a non-empty set V of vertices (or
nodes) and a set E (possibly empty) of
edges where each edge is associated with
a set consisting of either one or two
vertices called its endpoints.
Q: For a set V with n elements, how many
possible edges there?
Terminology
Loop, parallel edges, isolated, adjacent
Loop - an edge connects a vertex to itself
Two edges connect the same pair of
vertices are said to be parallel.
Isolated vertex unconnected vertex.
Two vertices that are connected by an
edge are called adjacent.
An edge is said to be incident on each of
its end points.
Example of a graph
Types of Graphs
Directed order
counts when
discussing edges
Undirected
(bidirectional)
Weighted each
edge has a value
associated with it
Unweighted
18 November 2014
Examples
http://richard.jones.name/google-hacks/google-cartography/google-cartography.html
18 November 2014
Special Graphs
Simple does not have any loops or parallel
edges
Complete graphs there is an edge between
every possible tuple of vertices
Bipartite graph V can be partitioned into V1
and V2, such that:
Sub graphs
G1 is a subset of G2 iff
Every vertex in G1 is in G2
Every edge in G1 is in G2
18 November 2014
Complete Graphs
Bipartite graph
10
Complete bipartite
11
Degree of Vertex
18 November 2014
12
Handshake Theorem
If G is any graph, then the sum of the
degrees of all the vertices of G equals
twice the number of edges of G.
Specifically, if the vertices of G are v1, v2,
, vn, where n is a nonnegative integer,
then:
18 November 2014
13
18 November 2014
14
15
18 November 2014
16
Learning Outcomes
Students should be able to:
Explain basic terminology of a graph
Identify Euler and Hamiltonian cycle
Represent graphs using adjacency matrices
17
18
Definitions
Terminology - Walk, path, simple path,
circuit, simple circuit.
Walk from two vertices is a finite alternating
sequence of adjacent vertices and edges
v0e1v1e2envn
18 November 2014
19
Path
Path a walk that does not contain a
repeated edge (may have a repeated
vertex)
v0e1v1e2envn where all the ei are distinct
Simple path a path that does not contain
a repeated vertex
v0e1v1e2envn where all the ei and vj are
distinct. e1 is represented by {v0,v1}.
20
Example - path
Path
v
Simple path
21
Circuit
22
Examples
Cuircuit
Simple circuit
23
Connectedness
Connectedness if there is a walk from
one to the other
Let G be a graph. Two vertices v and w of
G are connected if, and only if, there is a
walk from v to w.
The graph G is connected if, and only if,
given any two vertices v and w in G, there
is a walk from v to w.
24
Examples
25
Euler Circuits
A circuit that contains every vertex and
every edge of G.
A sequence of adjacent vertices and edges
18 November 2014
26
18 November 2014
27
18 November 2014
28
Euler Circuit
18 November 2014
29
Hamiltonian Path
A path in an undirected graph which visits
each vertex exactly once.
18 November 2014
30
Hamiltonian Circuit
A simple circuit that includes every vertex
of G.
A sequence of adjacent vertices and
distinct edges in which every vertex of G
appears exactly once, except for the first
and last, which are the same.
18 November 2014
31
Hamiltonian circuit
An Euler circuit for a graph G may not be
a Hamiltonian circuit.
An Hamiltonian circuit may not be an Euler
circuit.
32
Hamiltonian Circuit
Proved simple criterion for determining
whether a graph has an Euler circuit
No analogous criterion for determining
whether a graph has a Hamiltonian circuit
Nor is there an efficient algorithm for
finding such an algorithm
18 November 2014
33
Hamiltonian Circuit
34
http://en.wikipedia.org/wiki/Traveling_Sale
sman_Problem
18 November 2014
35
Learning Outcomes
Students should be able to:
Explain basic terminology of a graph
Identify Euler and Hamiltonian cycle
Represent graphs using adjacency matrices
36
18 November 2014
37
38
18 November 2014
39
Matrix multiplication
18 November 2014
40
18 November 2014
41
Summary
42