How can I stop a recursive call?
807607Nov 11 2006 — edited Nov 12 2006Or is that possible? That is, can I stop the recursion before the stack is empty?
I am trying to test for cycles in a graph, and print out only the edges which make up the cycle in the graph using depth first search. Or perhaps someone has some better ideas of how to do this, without attempting to do that clumsy "stop a recursive call" method?
To explain what I was thinking of: Go trough edges until a visited one is encountered (x). Then return back and terminate when we are back in that (x) edge. The (x) edge has a lable from the edge which called the dfs on the (x) edge, so that (x) is included in the cycle.
tnx in advance!