Constructing Hamiltonian Circuits - PowerPoint PPT Presentation

About This Presentation
Title:

Constructing Hamiltonian Circuits

Description:

A graph is a collection of vertices (or points) and edges (which connect the vertices) ... Pigeons = edges from A or B = 2(n/21) = n2. A. B. Worst case ... – PowerPoint PPT presentation

Number of Views:372
Avg rating:3.0/5.0
Slides: 21
Provided by: alanh62
Category:

less

Transcript and Presenter's Notes

Title: Constructing Hamiltonian Circuits


1
Constructing Hamiltonian Circuits
  • When all nodes have degree of at least n/2
  • (Also an implementation in C using Boost)
  • Presented by Alan Hogan _at_ SUnMaRC, February 2008

2
Graphs
  • A graph is a collection of vertices (or points)
    and edges (which connect the vertices).

3
Example Graph
Vertex
Edge
4
Paths and Circuits
  • Paths are series of vertices connected by edges
  • A circuit is a closed path (starts ends at the
    same vertex)

5
Path
Circuit
Start
Start
End
End
6
Hamiltonian Circuits
  • A Hamiltonian circuit is a closed path which
    visits every vertex in the graph exactly one time
  • Also called Hamiltonian Cycles

7
Plain Circuit
Hamiltonian
8
Problem
  • General algorithms to find Hamiltonian circuits
    are slow, running in non-polynomial time it is
    an NP-complete problem
  • We can use an efficient algorithm, however, in
    some cases, thanks to Dirac and Ore...

9
Diracs Theorem (1952)
  • A simple graph with n vertices (n gt 2) is
    Hamiltonian if each vertex has degree n/2 or
    greater.
  • (sufficient but not necessary)

10
Ores Theorem (1960)
  • Generalization of Diracs Theorem
  • If G is a simple graph with n vertices, where n
    3, and if for each pair of non-adjacent vertices
    v and w, deg(v) deg(w) n, then G is
    Hamiltonian

11
Also in Ores paper...
  • Ores restatement of Diracs principle lends
    itself to an interesting useful principle
  • For graphs satisfying the pre-requisite
    condition, an existing almost-complete
    Hamiltonian circuit with a gap between vertices A
    and B where there should be the final edge can
    be repaired.

12
Using Ores Algorinthm
  • Find a two vertices C D s.t. edges (A,C) and
    (B,D) exist (C,D) is in our almost-complete
    circuit and D lies between C and A on the
    partial circuit.
  • Connect vertex A to vertex C
  • Connect vertex B to a vertex D
  • Remove the edge between those two earlier
    vertices.

D
A
C
B
Missing edge
Repaired Full circuit
13
Steps of Ores principle
  • Find a set of vertices s.t. edges (A,C) and
    (B,D) exist, and (C,D) is an edge in our
    almost-complete Hamiltonian circuit.
  • Connect vertex A to vertex C
  • Connect vertex B to a vertex D
  • Remove the edge between those two earlier points.

14
Project Scope
  • Generally, finding a Hamiltonian path takes O(n!)
    time - NP-complete problem
  • This project deals exclusively with graphs of the
    type described by Ore.
  • For these graphs, we can quickly (in polynomial
    time) find the Hamiltonian path

15
Why does that work?
  • We know that at least one pair of such desirable
    contiguous earlier vertices C and D exist because
    each vertex has at least half as many edges as
    there are vertices
  • Proof by the pigeonhole principle
  • Boxes potential pairs of vertices C D n-3
  • Pigeons edges from A or B 2(n/2-1) n-2

16
Worst case(Edges not connected to A or B and not
on the circuit are not depicted)
A
B
D
C
17
Repeated Use
  • Repeated use of the algorithm suggested by Ores
    paper allows us to find a Hamiltonian circuit for
    any graph in our scope (all vertices have at
    least n/2 edges)

18
Our Algorithm
  1. Pretend we have a circuit
  2. Acknowledge one pretend edge does not really
    exist
  3. Fix that edge. We have a pretend circuit again,
    but its closer to true
  4. Go back to step 2. Repeat until all edges really
    exist

19
Repeating the Algorithm
  1. Pretend we have a circuit
  2. Acknowledge one pretend edge does not really
    exist
  3. Fix that edge. We have a pretend circuit again,
    but its closer to true
  4. Go back to step 2. Repeat until all edges really
    exist

A
B
C
D
20
Repeating the Algorithm
  1. Pretend we have a circuit
  2. Acknowledge one pretend edge does not really
    exist
  3. Fix that edge. We have a pretend circuit again,
    but its closer to true
  4. Go back to step 2. Repeat until all edges really
    exist

C
B
A
D
21
Implementation
  • The algorithm as discussed was slightly modified
    to use two graphs the pretend circuit, and the
    true graph
  • Implemented in C using the Boost graph library
    and Xcode
  • Command-line only (but a GUI frontend could be
    constructed)

22
Thank you.
  • alanhogan.com/asu/hamiltonian-circuitRead more
    about this project,download this presentation,
    or get a copy of the source code online.

23
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com