HAMITONIAN CIRCUITS (Using Backtracking Method)

Share Embed Donate


Short Description

Download HAMITONIAN CIRCUITS (Using Backtracking Method)...

Description

Agenda 

Definition of Hamiltonian



Definition of backtracking method



Backtracking algorithm



Example Example (using backtracking method)



Relationship between Hamiltonian and Tsp



Euler an circuit versus Hamiltonian circuit



Conclusion



References

05/15/12

2

Definition 

A hamiltonian circuit in a connected graph defined as a closed walk that traverse every vertex of G exactly once except the starting vertex at which the walk also terminate



A graph possessing a hamiltonian circuit circuit is said to be a hamiltonian graph. The hamiltonian circuit is names after sir  William Rowan Hamilton

05/15/12

3

Definition 

Backtracking constructs its state-space state-space tree tree in the depth–first depth–first search fashion in the majority of its applications



If the sequence sequence of choices choices represented represented by a current node of  the state-space tree can be developed further without violating the problems constraints



It is done by considering the first remaining legitimate option for the next component of the partially built solution and replace it by the next alternative

05/15/12

4

Backtracking algorithm Algorithm backtracking(X[1…..i]) backtracking(X[1…..i]) i=0; X[1…0] \ it reprints the empty tuple //Given a template template of of a generic backtracking backtracking algorithm //Input : X[1…i] specifies specifies first I promising components components of a solution //Output: All the tuples representing the problems solutions

05/15/12

5

Continue… If X[1…i] is a solution write X[1…..i] Else For each each element x € S i+1 consistent with X[1…..i] and the constraints Do X[i…..1] x Backtrack (X[1…i + 1] )

05/15/12

6

EXAMPLE FOR HAMILTON CIRCUIT (USING BACKTRACKING METHOD) METHOD)

b

a



c d

05/15/12

e

7

CONTINUE… a

b f  c e d

e c

e

d Dead end

f  Dead end

d

f  Dead end

a Found

05/15/12

8

RELATION BETWEEN HAMILTON AND TSP 

An optimal Hamilton circuit of a graph is one with the

smallest possible weight. There can be more than one. 

The problem of finding an optimal Hamilton circuit in a

complete weighted graph is often of ten called TSP(Traveling salesman  problem).  proble m). 

Commonly referred to as a TSP it simulates a salesman who

must visit each node preferably once go home at the end of the day and have traveled the least distance needed. Any path the salesman takes is a Hamiltonian circuit.

05/15/12

9

Eulerian circuit versus Hamiltonian circuit  An

eulerian circuit passes along each edge once and only once both are useful in application the Hamiltonian circuit when it is required to visit each vertex and the eulerian circuits when it is required to travel along all the connecting edges.

Euler an circuit not a Hamiltonian

05/15/12

Hamiltonian circuit but not a euler an

10

Eulerian circuit versus Hamiltonian circuit 

Condition for there to be Euler an circuits are well know but in general it is a difficult problem to decide when a given graph has a Hamiltonian circuit. Finding condition for the existence of  Hamiltonian circuit is an unsolved problem.



The degree of the vertex is the number of edges joining j oining onto that vertex, and vertices are said to be odd or even.



Euler circuit exist only in networks where there are no odd vertices, that is where all the vertices have have an even number of  edges ending there.

05/15/12

11

Knight queue Is a chess piece that can be move either to spaces horizontal one space vertical or one space horigentally and two space vertically. Knight on square (x,y) can move to any of the eight squares(x

05/15/12

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

12



Knight tour is a sequence of legal moves by a knight starting at some square and visiting each square exactly once.



A knight tour is a i.e reentrant if there is a legal move that take the knight from the last square of the tour back to where the tour begin. We draw the chess board and move of knight as a graph i.e all cells numbers 1 to 16 are vertices say vi & vj are adjecent if knight could reach jth cell from the ith cell.





05/15/12

13

REFERENCES

Kenneth





05/15/12

H Rosen, 6th edition

Anany levitin Elements of descrete mathematics, 2 nd edition.

14

THANK YOU…

05/15/12

15

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF