You are on page 1of 1

Consider city 1 as the starting and

ending point. Since the route is cyclic,


we can consider any point as a starting
point.
1. Generate all (n-1)!
permutations of cities.
2. Calculate the cost of every
permutation and keep track of
the minimum cost
permutation.
3. Return the permutation with
minimum cost.

In above figure, there are 4 cities(1,2,3,4). And there are (4-1)! = 3! = 6


possible ways to reach destination city and move back to city where he
started. He chose (1-2-4-3-1) way to minimise the distance.

Output of Given Graph:


minimum weight Hamiltonian Cycle :
10 + 25 + 30 + 15 := 80

You might also like