euler & hamilton by piyawat.87

VIEWS: 44 PAGES: 19

More Info
									Paths & Circuits
Paths & Cycles
                Euler Paths
• An Euler path in a graph is a simple path
  containing every edges of that graph.
                Euler Circuits
• An Euler circuit in a graph is a simple circuit
  containing every edges of that graph.
            Euler Paths & Circuits
• An Euler circuit in a graph is a circuit that traverses all
  the edges in the graph once.
• An Euler path in a graph is a path that traverses all
  the edges in the graph once.
• An undirected multi-graph has an Euler circuit if and
  only if it is connected and has all vertices of even
  degree.
• An undirected multi-graph has an Euler path, but not
  Euler circuit, if and only if it is connected and has
  exactly two vertices of odd degree.
      Condition of Euler Circuits
• A connected multi-graph with at least two
  vertices has an Euler circuit ↔ each of its
  vertices has even degree.

• Necessary condition: G has an Euler Circuit →
  each of its vertices must have even degree.

• Sufficient condition: Each of the vertices in G
  has even degree → G has an Euler Circuit.
           Find an Euler Circuit
• G has an Euler Circuit → each of its vertices must
  have even degree.
• Each of the vertices in G has even degree → G has an
  Euler Circuit.
Find an Euler Circuit
        Condition of Euler path
• A connected multi-graph with at least two
  vertices has an Euler path ↔ it has exactly 2
  vertices with odd degree.
Find an Euler Path
                  Euler Circuit Problem
ลากเส้ นตามรูปโดยไม่ ซ้า




       (Euler path)        (Euler Circuit)
Euler Paths & Circuits
       Hamilton Paths & Circuits
• A Hamilton path in a graph is a simple path
  that passes through every vertex of the graph
  exactly once.

• For G=(V,E) and V = {v1, v2, …, vn}, the simple
  circuit v1,v2,…,vn,v0 is a Hamilton circuit if
  v1,v2,…,vn is a Hamilton path.
        Hamilton Paths & Circuits
• A Hamilton circuit in a graph is a (simple) circuit that
  visits each vertex in the graph once.
• A Hamilton path in a graph is a (simple) path that
  visits each vertex in the graph once
Iconion Puzzle
    Condition of Hamilton Circuits
• No ‘necessary & sufficient’ conditions exist.
• Certain properties can be used to show that no
  Hamilton circuits exist. E.g. degree one vertex.
• Both edges incident of a vertex of degree two
  must be part of any Hamilton circuit.
• While constructing a Hamilton circuit, if a vertex
  has already passes through, all remaining edges
  of that vertex can be removed from
  consideration.
       Some sufficient condition
• If G is a simple graph with n vertices (n≥3)
  such that the degree of every vertex in G is at
  least n/2, then G has a Hamilton circuit.

• If G is a simple graph with n vertices (n≥3)
  such that deg(u)+deg(v) ≥ n for every pair of
  non-adjacent vertices u and v in G, then G has
  a Hamilton circuit.
                          Hamilton Circuit
 ลากผ่ านจุดทุกจุดๆ ละหนึ่งครั้ง


                                   1


                      5                                       10
                                           2
                                                      1        2       3
                          4            3
                                               13     4            5   6
                     กราฟที่มีวงจร Hamilton                                    11
                                                          7        8       9


                                                               12

William Rowan Hamilton (1805–1865)                  กราฟที่ไม่มีวงจร Hamilton
    Traveling Salesperson Problem
• A salesman is required to visit a number of cities
  during a trip. Given the distances between cities, in
  what order should he travel so as to visit every city
  precisely once and return home, with the minimum
  mileage traveled ?




            Input                     Output

								
To top