Is there a way in which Depth First Traversal will put a node into the stack more than once using the general algorithm as shown here.Also, is it compulsory for all nodes to be entered into the stack atleast once? Is there any case in which a node is not entered into the stack?
Can a Depth first traversal of a graph visit node more than once?
algorithms;graph theory
Depth first search will put a node into the stack only once. The usual way to perform DFS involves marking a vertex as marked while pushing it into the stack and not pushing an already marked vertex again.A node will not enter the stack if and only if it is not part of the connected component involving the DFS start vertex. This only matters for graphs made out of disjoint connected components and not for connected graphs.