next up previous contents
Next: MPI - Message Passing Up: Background Previous: Crank-Nicholson Method   Contents

Hamiltonian Path Problem

In Graph Theory, a graph is usually defined to be a collection of nodes or vertices and the set of edges which define which nodes are connected with each other. So we use a well known notation of representing a graph
G = (V,E) where $V = \{v_1, v_2, v_3, ... ,v_n\}$ and
$E = \{(i,j)\vert i\in V$ and $j\in V$ and i and j is connected}

Hamiltonian Path is defined to be a single path that visits every node in the given graph, or a permutation of nodes in such a way that for every adjacent node in the permutation there is an edge defined in the graph.

Notice that it does not make much sense in repeating the same paths. In order to avoid this repetition, we permute with ${\vert V\vert \choose 2}$ combinations of starting and ending vertices.

Simple way of solving the Hamiltonian Path problem would be to permutate all possible paths and see if edges exist on all the adjacent nodes in the permutation. If the graph is a complete graph, then naturally all generated permutations would quality as a Hamiltonian path.

For example. let us find a hamiltonian path in graph G = (V,E) where V = {1,2,3,4} and E = {(1,2),(2,3),(3,4)}.
Just by inspection, we can easily see that the hamiltonian path exists in permutation 1234. The given algorithm will first generate the following permutations based on the combinations:
1342 1432 1243 1423 1234 1324 2143 2413 2134 2314 3124 3214
The number that has to be generated is ${\vert V\vert \choose 2} (\vert V\vert-2)!$


next up previous contents
Next: MPI - Message Passing Up: Background Previous: Crank-Nicholson Method   Contents
J S 2002-08-14