day26 - COP 3503 – Computer Science II – CLASS NOTES...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COP 3503 – Computer Science II – CLASS NOTES - DAY #26 Hamiltonian Graphs A Hamiltonian cycle in a graph is a cycle that passes through all the vertices of the graph. Recall that we mentioned this type of cycle when we were examining Euler paths and Euler circuits. A graph is called a Hamiltonian graph if it includes at least one Hamiltonian cycle. There is no formula which characterizes a Hamiltonian graph as there was with an Euler graph. However, it should be obvious that all complete graphs are Hamiltonian. The question is how to find a Hamiltonian cycle in a graph. The answer lies in the following theorem: Basically, this theorem says that some Hamiltonian graphs allow us to create Hamiltonian graphs by eliminating some of the edges in the graph. The theorem leads directly to an algorithm that first expands the original graph to a graph with more edges in which finding a Hamiltonian cycle is easy (a complete graph) and then manipulates the Hamiltonian cycle by adding some edges and removing other edges so that eventually a Hamiltonian cycle is formed that includes the edges that belong to the original graph. An algorithm that is based on this theorem was developed by Chvátal in 1985. The algorithm is shown below: HamiltonianCycle( graph G = V, E)) set lable of all edges to 0; k = 1; H = E; G H = G; while G H contains nonadjacent vertices v, u where deg H (v) + deg H (u) ≥ V H = H ∪ { edge(vu) }; G H = (V, H); label (edge(vu)) = k++; if there exists a Hamiltonian cycle C while (k = max{ label(edge(pq)) : edge(pq) ∈ C}) > 0 C =...
View Full Document

{[ snackBarMessage ]}

Page1 / 5

day26 - COP 3503 – Computer Science II – CLASS NOTES...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online