I need an algorithm. Given: a dynamically generated graph (you have to visit a node to calculate the list of its neighbours, at a cost), and a starting node, I want to find out:
* Whether every node can reach this starting node.
* With an early exit as soon as a counter-example is found, optimised for finding the counter-example as soon as possible (for instance, a dead end is an easy early exit).
* With a limit on the complexity, IE, if it takes too long to calculate, give up.
Any ideas?