Here's a pretty simple idea, in this pastebin I've posted some pair of numbers. These represent Nodes of a directed graph. The input to
stdin will be of the form, (they'll be numbers, i'll be using an example here)
c d q r a b b c d e p q
x y means
x is connected to
y (not viceversa)
There are 2 paths in that example.
You need to print all the unique paths from that graph The output should be of the format
- You can assume the numbers are chosen such that one path doesn't intersect the other (one node belongs to one path)
- The pairs are in random order.
- They are more than 1 paths, they can be of different lengths.
- All numbers are less than 1000.
If you need more details, please leave a comment. I'll amend as required.
For those who enjoy Codegolf, please Commit at Area51 for its very own site:) (for those who don't enjoy it, please support it as well, so we'll stay out of your way...)