SULE SOLMAZ BEYZA AYTAR

Slides:



Advertisements
Similar presentations
Introduction to Graph Theory Lecture 11: Eulerian and Hamiltonian Graphs.
Advertisements

Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.
1 Chapter 15.3 Hamilton Paths and Hamilton Circuits Objectives 1.Understand the definitions of Hamilton paths & Hamilton circuits. 2.Find the number of.
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part R5. Graphs.
Computability and Complexity 16-1 Computability and Complexity Andrei Bulatov NP-Completeness.
GRAPH Learning Outcomes Students should be able to:
Algorithms: Design and Analysis Summer School 2013 at VIASM: Random Structures and Algorithms Lecture 3: Greedy algorithms Phan Th ị Hà D ươ ng 1.
Slide 14-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.
Graph Theory Hamilton Paths and Hamilton Circuits.
Representing and Using Graphs
6.1 Hamilton Circuits and Paths: Hamilton Circuits and Paths: Hamilton Path: Travels to each vertex once and only once… Hamilton Path: Travels to each.
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.3 Hamilton Paths, and Hamilton Circuits.
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg.
Graph Theory Hamilton Paths Hamilton Circuits and.
NPC.
I can describe the differences between Hamilton and Euler circuits and find efficient Hamilton circuits in graphs. Hamilton Circuits I can compare and.
Chapter 14 Section 3 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
Grade 11 AP Mathematics Graph Theory Definition: A graph, G, is a set of vertices v(G) = {v 1, v 2, v 3, …, v n } and edges e(G) = {v i v j where 1 ≤ i,
Ch3 /Lecture #4 Brute Force and Exhaustive Search 1.
MAT 110 Workshop Created by Michael Brown, Haden McDonald & Myra Bentley for use by the Center for Academic Support.
An Introduction to Graph Theory
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Limitation of Computation Power – P, NP, and NP-complete
More NP-complete problems
Hamilton Paths and Hamilton Circuits
Graphs Chapter 20.
EECS 203 Lecture 19 Graphs.
Shortest Path Problems
Redraw these graphs so that none of the line intersect except at the vertices B C D E F G H.
Lecture 2-2 NP Class.
Routing Through Networks - 1
Agenda Lecture Content: Introduction to Graph Path and Cycle
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
HAMILTONIAN CIRCUIT ALGORITHMS
EECS 203 Lecture 20 More Graphs.
Great Theoretical Ideas in Computer Science
Chapter 2: Business Efficiency Lesson Plan
Topological Sort (topological order)
CS120 Graphs.
Discrete Maths 9. Graphs Objective
Chapter 2: Business Efficiency Lesson Plan
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Section 14.3 Hamilton Paths, and Hamilton Circuits
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Graph Theory.
Graphs Chapter 13.
Richard Anderson Lecture 25 NP-Completeness
Genome Assembly.
Graphs Chapter 11 Objectives Upon completion you will be able to:
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Chapter 2: Business Efficiency Business Efficiency
Discrete Math II Howon Kim
Approximation Algorithms
A path that uses every vertex of the graph exactly once.
3. Brute Force Selection sort Brute-Force string matching
3. Brute Force Selection sort Brute-Force string matching
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Hamilton Paths and Hamilton Circuits
Euler and Hamiltonian Graphs
CSC 380: Design and Analysis of Algorithms
Euler circuit Theorem 1 If a graph G has an Eulerian path, then it must have exactly two odd vertices. Theorem 2 If a graph G has an Eulerian circuit,
Graphs CS 2606.
Traveling Salesman Problems Nearest Neighbor Method
Lecture 24 Classical NP-hard Problems
Concepts of Computation
Hamiltonian Circuit (HC) problem
3. Brute Force Selection sort Brute-Force string matching
Presentation transcript:

SULE SOLMAZ 140144053 BEYZA AYTAR 140144009 HAMILTONION PATH SULE SOLMAZ 140144053 BEYZA AYTAR 140144009

What is the Hamiltonian Path?? Hamiltonian Path also called a Hamilton path, in a directed or undirected graph is a graph path between two vertices of a graph that visit each vertex exactly once The problem to check whether a graph (directed or undirected) contains a Hamiltonian Path is NP-complete, so is the problem of finding all the Hamiltonian Paths in a graph. Hamiltonian Cycle: Hamiltonian path exists whose endpoints are adjacent, then the resulting graph cycle is called a Hamiltonian cycle . ( The circuit must return to the starting vertex)

A permutation of the vertices of the graph [v1, v2, v3, A permutation of the vertices of the graph [v1, v2, v3, ...... vN-1, vN] , such that there is an edge between  vi and vi+1 where 1 ≤ i ≤ N-1. It can be checked for all permutations of the vertices whether any of them represents a Hamiltonian Path or not. Total 24 possible permutations, out of which only following represents a Hamiltonian Path in Fig. 2. which only following represents a Hamiltonian Path. 0-1-2-3 3-2-1-0 0-1-3-2 2-3-1-0

PROPERTIES OF HAMILTONION PATH Any hamiltonian cycle can be transformed into a hamiltonian path by removing a single edge. For strongly connected graphs, the number of different hamiltonian path is (n-1)!/2.

Usage Areas of Hamiltonian path Many graphs can be used to solve the theory problem such as the travelling salesman problem. They can be used in data security (cryptography) problems such as zero-knowledge proof. Gray codes

Following is the pseudo code of the algorithm: function check_all_permutations(adj[][], n) for i = 0 to n p[i]=i while next permutation is possible valid = true for i = 0 to n-1 if adj[p[i]][p[i+1]] == false valid = false break if valid == true return true p = get_next_permutation(p) return false

COMPLEXITY Time complexity of the method can be easily derived on the previous slide. For a graph having N vertices it visits all the permutations of the vertices, N! iterations and in each of those iterations it traverses the permutation to see if adjacent vertices are connected or not N iterations, so the complexity is O( N * N! ).

Travelling Salesman Nearest Neighbor Algorithm: Starting from the “home” city(or vertex),first visit the nearest city (one with the least mileage from “home”),that has not already been visited. When all other vertices have been visited,the tour returns home. Hamiltonian Circuit: Hamiltonian Circuit: A-B-C-E-D-A B-C-A-D-E-B Nearest neighbor starting at vertex A Nearest neighbor starting at vertex B

The problem here: We have a weighted graph, and want to find the circuit with the lowest weight. The usual explanation: a salesman has to visit all of his clients and wants to make the journey with the least time/distance/fuel. We use the value we're trying to minimize as the edge weight.

1. Greedy approach: According to this approach, any city is selected as the starting city after that s the nearest city is selected and added to the list. In this way all the cities are added to the list until the last city added .We will always selected as the nearest city. 2. Smallest increase method: In this method, the total distance is recalculated every time, and if any of the alternatives is added, the total distance traveled is minimized and new cities are added.

Gray Code Animation Here we show a Hamiltonian cycle on a 5-dimensional hypercube. Note that it starts by completely traversing the 4- dimensional hypercube on the left before reversing the traversal on the right subcube. Hamiltonian cycles on hypercubes provide constructions for Gray codes, namely orderings of all subsets of n items such that neighboring subsets differ in exactly one element. Hamilitonian cycle is an NP-complete problem, so no worst-case efficient algorithm exists to find such a cycle.

References http://www3.cs.stonybrook.edu/~algorith/files/hamiltonian-cycle.shtml http://slideplayer.com/slide/7805935/ https://www.cs.sfu.ca/~ggbaker/zju/math/euler-ham.html#ham http://bilgisayarkavramlari.sadievrenseker.com/2009/06/17/hamilton-yolu-hamiltonian- pathhamiltonian-circuit/ http://bilgisayarkavramlari.sadievrenseker.com/2008/08/28/seyyar-tuccar-problemi- traveling-salesman-problem/ http://www.ensarkarabudak.com/muhendislik/hamilton-yolu-devresihamiltonian-path- and-hamiltonian-circuit/ http://www.geeksforgeeks.org/travelling-salesman-problem-set-1/ http://www3.cs.stonybrook.edu/~skiena/combinatorica/animations/ham.html

THANK FOR LISTENING