I\'m trying to solve a slightly modified version of the Hamiltonian Path problem. It is modified in that the start and end points are given to us and instead of determining
You could still use a bidirectional search, just add a constraint to the search so that previously seen nodes will not be candidates for searching.
Another approach you could take which would lend itself to a paralellizable solution is to break the search into smaller searches.
For example, try to solve your original problem by solving:
For each node, n, which is not a start or end node, find all paths from the start to n (set1) and from n to the end (set2).
After you find set1
and set2
, you can discard all elements of their cross product which have a common node other than node n
.