You may enumerate all permutations to solve this problem.
There are no more than 8 nodes in the input graph; so the maximum number of permutations is 40320, and an exhaustive search is acceptable.