3 ms·
For an alternative solution, describe the directed graph by listing the nodes and using whitespace to represent the arcs: $ cat riddle Vixen Rudolph Vixe
by soveran 4y ago
For an alternative solution, describe the directed graph by listing the nodes and using whitespace to represent the arcs:
$ cat riddle
Vixen Rudolph
Vixen Prancer
Vixen Dasher
Dancer Vixen
Comet Vixen
...
Vixen Dasher
Then use tsort:
$ tsort riddle
Dancer
Donder
Comet
Vixen
Blitzen
Dasher
Rudolph
Cupid
Prancer
- gpderetta 4y agoYep, I was wondering if this didn't just need a topological sort (as shown by the make solution elsethread).