I have a small problem where I need to find all possible paths given a set of numbers. For example, lets say we have numbers 1, 2 and 3. I need to find all the possible combinations. The result for this simple case is:
path_1 = 1
path_2 = 2
path_3 = 3
path_4 = 1, 2
path_5 = 1, 3
path_6 = 2, 3
path_7 = 1, 2, 3
It is simple to see that the number of paths is (2^n)-1, so for 3 elements, it is 7, and so on. It is quite simple to do this by hand for a small number of elements, but as the numbers get big, it gets harder and harder.
Someone has suggested that I can use the boost graph library for this problem, but am not quite sure how to do as I do not have enough experience with it. Any help would be much appreciated.
Thanks in advance
1 Answer