If the graph will ever have loops in it, then no - there is no reliable way to understand this, since the question is equivalent to the problem with stopping . Short version: it is impossible for a program, given an arbitrary other program, to even determine whether it will ever be returned. You could identify potential infinite loops, but the only way to get close to a specific one is to actually run the program with a comprehensive set of inputs.
source
share