Implement search through the network tree
This could not be implemented as a usual DFS since we cannot simply
have a recursive solution here and need to be able to break the
search at any time.
However, it needs to be tracked where in the graph we are when we
are walking through it to extract the informaton encoded into the
edges.
This is now solved by using a stack that keeps that information
as we walk through the graph.
This solution uses O(1) in memory since the stack can not be larger
than 256 nodes (the maximum path length should be 128).
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Showing
Please register or sign in to comment