I have a tricky logic question and I am trying to create an algorithm to solve it, but I am struggling to get my head around it.
Consider this data:
A to B
A to C
A to D
A to E
B to C
B to D
B to E
C to D
C to E
D to E
As you can see this effectively produces a model like so: A - B - C - D - E
You can only go in one direction, (left to right) and what I want to write is an algorithm that can work out all the possible combinations between 2 points i.e.
If I wanted to go from A
to E
all the possible combinations are like so:
A - E
A - D - E
A - C - E
A - B - E
A - C - D - E
A - B - D - E
A - B - C - E
A - B - C - D - E
I think that's all.
Could someone help me with the logic to help me work this problem out?