Given the following graph:

What algorithm can I use to output topological ordered lists with tasks to complete, and that are relevant for just for a specific node?
For example, considering the node 2, the list should be:
7, 5, 11, 2
or
5, 7, 11, 2
2Example:
Enter 2
Enter 11
Enter 7
Leave 7, insert into list
Enter 5
Leave 5, insert into list
Leave 11, insert into list
Done, insert 2 into list
Result: 7, 5, 11, 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With