5c5f9Eulerian Path & Hamilton Ian Path

Embed Size (px)

Citation preview

  • 8/6/2019 5c5f9Eulerian Path & Hamilton Ian Path

    1/4

    Eulerian path

    In graph theory, an Eulerian path is apath in a graph which visits each edge exactlyonce. Similarly, an Eulerian circuit is an Eulerian path which starts and ends on the

    same vertex. They were first discussed by Leonhard Eulerwhile solving the famousSeven Bridges of Knigsberg problem in 1736. Mathematically the problem can be stated

    like this:

    Given the graph on the right, is it possible to construct a path (or a cycle, i.e. a

    path starting and ending on the same vertex) which visits each edge exactly once?

    Graphs which allow the construction of so called Eulerian circuits are called Euleriangraphs. Euler observed that a necessary condition for the existence of Eulerian circuits isthat all vertices in the graph have an even degree, and that for an Eulerian path either all,

    or all but two (i.e., the two endpoint) vertices have an even degree; this means the

    Knigsberg graph is notEulerian. Sometimes a graph that has an Eulerian path, but notan Eulerian circuit (in other words, it is an open path, and does not start and end at the

    same vertex) is called semi-Eulerian.

    Carl Hierholzerpublished the first complete characterization of Eulerian graphs in 1873,

    by proving that in fact the Eulerian graphs are exactly the graphs which are connectedand where every vertex has an even degree.

    Definition

    An Eulerian path, Eulerian trail orEuler walkin an undirected graphis apaththat

    uses each edge exactly once. If such a path exists, the graph is called traversable orsemi-eulerian.

    An Eulerian cycle, Eulerian circuit orEuler tour in an undirected graph is a cycle that

    uses each edge exactly once. If such a cycle exists, the graph is called Eulerian orunicursal. The cycle starts and ends at the same vertex.

    Fordirected graphs path has to be replaced with directed path and cycle with directedcycle.

    The definition and properties of Eulerian paths, cycles and graphs are valid for

    multigraphs as well

    Properties

    A connectedundirected graph is Eulerian if every graph vertex has an even

    degree.

    http://en.wikipedia.org/wiki/Graph_theoryhttp://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Edge_(graph_theory)http://en.wikipedia.org/wiki/Vertex_(graph_theory)http://en.wikipedia.org/wiki/Leonhard_Eulerhttp://en.wikipedia.org/wiki/Seven_Bridges_of_K%C3%B6nigsberghttp://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Degree_(graph_theory)http://en.wikipedia.org/wiki/Degree_(graph_theory)http://en.wikipedia.org/wiki/Carl_Hierholzerhttp://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Directed_graphhttp://en.wikipedia.org/wiki/Directed_path_(graph_theory)http://en.wikipedia.org/wiki/Directed_cyclehttp://en.wikipedia.org/wiki/Directed_cyclehttp://en.wikipedia.org/wiki/Directed_cyclehttp://en.wikipedia.org/wiki/Multigraphhttp://en.wikipedia.org/wiki/Connected_(graph_theory)http://en.wikipedia.org/wiki/Connected_(graph_theory)http://en.wikipedia.org/wiki/Graph_theoryhttp://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Edge_(graph_theory)http://en.wikipedia.org/wiki/Vertex_(graph_theory)http://en.wikipedia.org/wiki/Leonhard_Eulerhttp://en.wikipedia.org/wiki/Seven_Bridges_of_K%C3%B6nigsberghttp://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Degree_(graph_theory)http://en.wikipedia.org/wiki/Carl_Hierholzerhttp://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Directed_graphhttp://en.wikipedia.org/wiki/Directed_path_(graph_theory)http://en.wikipedia.org/wiki/Directed_cyclehttp://en.wikipedia.org/wiki/Directed_cyclehttp://en.wikipedia.org/wiki/Multigraphhttp://en.wikipedia.org/wiki/Connected_(graph_theory)
  • 8/6/2019 5c5f9Eulerian Path & Hamilton Ian Path

    2/4

    An undirected graph is Eulerian if it is connected and can be decomposed into

    edge-disjoint cycles.

    If an undirected graph G is Eulerian then itsline graphL(G) is Eulerian too.

    A directed graph is Eulerian if it is connected and every vertex has equal in

    degree andout degree.

    A directed graph is Eulerian if it is connected and can be decomposed into edge-disjoint directed cycles.

    An undirected graph is traversable if it is connected and at most two vertices in

    the graph are of odd degree.

    Hamiltonian path

    In the mathematicalfield ofgraph theory, a Hamiltonian path is apath in anundirectedgraph which visits each vertex exactly once. A Hamiltonian cycle (orHamiltoniancircuit) is a cycle in anundirected graph which visits each vertexexactly once and alsoreturns to the starting vertex. Determining whether such paths and cycles exist in graphs

    is the Hamiltonian path problemwhich isNP-complete.

    Hamiltonian paths and cycles are named afterWilliam Rowan Hamilton who invented

    the Icosian Game, now also known asHamilton's puzzle, which involves finding aHamiltonian cycle in the edge graph of the dodecahedron. Hamilton solved this problem

    using the Icosian Calculus, an algebraic structure based on roots of unity with many

    similarities to the quaternions(also invented by Hamilton). Unfortunately, this solution

    does not generalize to arbitrary graphs.

    Definitions

    AHamiltonian path ortraceable path is apaththat visits each vertex exactly once. A

    graph that contains a Hamiltonian path is called a traceable graph. A graph isHamilton-

    connectedif for every pair of vertices there is a Hamiltonian path between the two

    vertices.

    AHamiltonian cycle,Hamiltonian circuit, vertex tourorgraph cycle is a cyclethat visitseach vertex exactly once (except the vertex which is both the start and end, and so isvisited twice). A graph that contains a Hamiltonian cycle is called a Hamiltonian graph.

    Similar notions may be defined fordirected graphs, where each edge (arc) of a path or

    cycle can only be traced in a single direction (i.e., the vertices are connected with arrows

    and the edges traced "tail-to-head").

    http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Line_graphhttp://en.wikipedia.org/wiki/Line_graphhttp://en.wikipedia.org/wiki/In_degree_(graph_theory)http://en.wikipedia.org/wiki/In_degree_(graph_theory)http://en.wikipedia.org/wiki/Out_degree_(graph_theory)http://en.wikipedia.org/wiki/Out_degree_(graph_theory)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Mathematicshttp://en.wikipedia.org/wiki/Mathematicshttp://en.wikipedia.org/wiki/Graph_theoryhttp://en.wikipedia.org/wiki/Graph_theoryhttp://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Vertex_(graph_theory)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Vertex_(graph_theory)http://en.wikipedia.org/wiki/Vertex_(graph_theory)http://en.wikipedia.org/wiki/Hamiltonian_path_problemhttp://en.wikipedia.org/wiki/Hamiltonian_path_problemhttp://en.wikipedia.org/wiki/NP-complete_problemhttp://en.wikipedia.org/wiki/William_Rowan_Hamiltonhttp://en.wikipedia.org/wiki/Icosian_Gamehttp://en.wikipedia.org/wiki/Dodecahedronhttp://en.wikipedia.org/wiki/Dodecahedronhttp://en.wikipedia.org/wiki/Icosian_Calculushttp://en.wikipedia.org/wiki/Icosian_Calculushttp://en.wikipedia.org/wiki/Algebraic_structurehttp://en.wikipedia.org/wiki/Root_of_unityhttp://en.wikipedia.org/wiki/Quaternionhttp://en.wikipedia.org/wiki/Quaternionhttp://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Graph_(mathematics)http://en.wikipedia.org/wiki/Graph_(mathematics)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Line_graphhttp://en.wikipedia.org/wiki/In_degree_(graph_theory)http://en.wikipedia.org/wiki/In_degree_(graph_theory)http://en.wikipedia.org/wiki/Out_degree_(graph_theory)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Mathematicshttp://en.wikipedia.org/wiki/Graph_theoryhttp://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Vertex_(graph_theory)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Undirected_graphhttp://en.wikipedia.org/wiki/Vertex_(graph_theory)http://en.wikipedia.org/wiki/Hamiltonian_path_problemhttp://en.wikipedia.org/wiki/NP-complete_problemhttp://en.wikipedia.org/wiki/William_Rowan_Hamiltonhttp://en.wikipedia.org/wiki/Icosian_Gamehttp://en.wikipedia.org/wiki/Dodecahedronhttp://en.wikipedia.org/wiki/Icosian_Calculushttp://en.wikipedia.org/wiki/Algebraic_structurehttp://en.wikipedia.org/wiki/Root_of_unityhttp://en.wikipedia.org/wiki/Quaternionhttp://en.wikipedia.org/wiki/Path_(graph_theory)http://en.wikipedia.org/wiki/Cycle_(graph_theory)http://en.wikipedia.org/wiki/Graph_(mathematics)
  • 8/6/2019 5c5f9Eulerian Path & Hamilton Ian Path

    3/4

    AHamiltonian decomposition is an edge decomposition of a graph into Hamiltonian

    circuits

    Examples

    acomplete graph with more than two vertices is Hamiltonian every cycle graphis Hamiltonian

    every tournamenthas an odd number of Hamiltonian paths

    everyplatonic solid, considered as a graph, is Hamiltonian

    Properties

    Any Hamiltonian cycle can be converted to a Hamiltonian path by removing one of itsedges, but a Hamiltonian path can be extended to Hamiltonian cycle only if its endpoints

    are adjacent.

    The line graph of a Hamiltonian graph is Hamiltonian. The line graph of an Eulerian

    graph is Hamiltonian.

    A tournament (with more than 2 vertices) is Hamiltonian if and only if it is strongly

    connected.

    A Hamiltonian cycle may be used as the basis of a zero-knowledge proof.

    The Travelling Salesman Problem (TSP) is a deceptively simple combinatorial

    problem. It can be stated very simply:

    A salesman spends his time visiting n cities (or nodes) cyclically. In one

    tour he visits each city just once, and finishes up where he started. In what

    order should he visit them to minimise the distance travelled?

    http://en.wikipedia.org/wiki/Glossary_of_graph_theoryhttp://en.wikipedia.org/wiki/Complete_graphhttp://en.wikipedia.org/wiki/Complete_graphhttp://en.wikipedia.org/wiki/Cycle_graphhttp://en.wikipedia.org/wiki/Cycle_graphhttp://en.wikipedia.org/wiki/Tournament_(graph_theory)http://en.wikipedia.org/wiki/Tournament_(graph_theory)http://en.wikipedia.org/wiki/Platonic_solidhttp://en.wikipedia.org/wiki/Line_graphhttp://en.wikipedia.org/wiki/Eulerian_graphhttp://en.wikipedia.org/wiki/Eulerian_graphhttp://en.wikipedia.org/wiki/Strongly_connected_componenthttp://en.wikipedia.org/wiki/Strongly_connected_componenthttp://en.wikipedia.org/wiki/Zero-knowledge_proof#Examplehttp://en.wikipedia.org/wiki/Zero-knowledge_proof#Examplehttp://en.wikipedia.org/wiki/Glossary_of_graph_theoryhttp://en.wikipedia.org/wiki/Complete_graphhttp://en.wikipedia.org/wiki/Cycle_graphhttp://en.wikipedia.org/wiki/Tournament_(graph_theory)http://en.wikipedia.org/wiki/Platonic_solidhttp://en.wikipedia.org/wiki/Line_graphhttp://en.wikipedia.org/wiki/Eulerian_graphhttp://en.wikipedia.org/wiki/Eulerian_graphhttp://en.wikipedia.org/wiki/Strongly_connected_componenthttp://en.wikipedia.org/wiki/Strongly_connected_componenthttp://en.wikipedia.org/wiki/Zero-knowledge_proof#Example
  • 8/6/2019 5c5f9Eulerian Path & Hamilton Ian Path

    4/4

    Many TSP's aresymmetric - that is, for any two cities A and B, thedistance from A to B is the same as that from B to A. In this case you will

    get exactly the same tour length if you reverse the order in which they are

    visited - so there is no need to distinguish between a tour and its reverse, and

    you can leave off the arrows on the tour diagram.

    If there are only 2 cities then the problem is trivial, since only one tour is

    possible. For the symmetric case a 3 city TSP is also trivial. If all links are

    present then there are (n-1)! different tours for an n city asymmetric TSP. To

    see why this is so, pick any city as the first - then there are n-1 choices for the

    second city visited, n-2 choices for the third, and so on. For the symmetric case

    there are half as many distinct solutions - (n-1)!/2 for an n city TSP. In either

    case the number of solutions becomes extremely large for large n, so that an

    exhaustive search is impractible.

    The problem has some direct importance, since quite a lot of practicalapplications can be put in this form. It also has a theoretical importance in

    complexity theory, since the TSP is one of the class of "NP Complete"

    combinatorial problems. NP Complete problems have intractable in the sense

    that no one has found any really efficient way of solving them for large n. They

    are also known to be more or less equivalent to each other; if you knew how to

    solve one kind of NP Complete problem you could solve the lot.

    The holy grail is to find a solution algorithm that gives an optimalsolution in atime that has apolynomialvariation with the size n of the problem. If you could

    find a method whose solution time varies like a quadratic expression, for

    example, then doubling n multiplies the solution time by 4 for large n. The best

    that people have been able to do, however, is to solve it in a time that varies

    exponentially with n. Such algorithms run out of puff at a certain level of n,

    more or less independently of computing power. If computation varies as 2^n,

    say, then a thousand-fold increase in computing power will only allow you to

    add another 10 nodes. So an algorithm that peters out at 50 cites now will

    probably never get you to 100 nodes, whatever happens to hardware

    technology.

    Alternatively there are algorithms that seem to come up with agoodsolution

    quite quickly, but you cannot say just how far it is from being optimal.