I am trying to code up something like this: I have a square with 1 point on each edge (1,2,3,4). I want to list all possibilities to reach from 1 to 4 like 1,2,3,4
and 1,3,2,4. There might be more than one squares and points, and I always go from a point to another. For example, I have two merged squares, and therefore there exists 6 edges and 6 points. I want to go from 1 to 6, now. My possible ways are 1,2,3,6; 1,4,5,6; 1,2,5,6; and so on. Is there an algorithm or an easy way to do this on c++? I will use this as an input to another code.
Ok, I am sorry, I will explain more clearly. I have two squares that are merged. So, we have 6 points and edges. Points 1,2,3 are at the top and 4,5,6 are at the bottom. Thus, I can go from 1 to 6 through the path 1,2,3,6 or 1,4,5,6 or 1,2,5,6, and so on. Is it more clear now?
Actually I need to print all the paths between two nodes. It is an undirected graph. The edges are 1-2, 1-3, 2-4, 3-4. I should find the paths between node 1 and 4. I will have roughly 50 of the nodes, so I need an efficient algorithm. Is there a sample code to use?