Class  Search Algorithm 

Data structure  Graph 
Worst case performance  O(  V  +  E  ) 
In computer science depthlimited search is an algorithm to explore the vertices of a graph. It is a modification of depthfirst search and is used for example in the iterative deepening depthfirst search algorithm.
Contents 
Like the normal depthfirst search, depthlimited search is an uninformed search. It works exactly like depthfirst search, but avoids its drawbacks regarding completeness by imposing a maximum limit on the depth of the search. Even if the search could still expand a vertex beyond that depth, it will not do so and thereby it will not follow infinitely deep paths or get stuck in cycles. Therefore depthlimited search will find a solution if it is within the depth limit, which guarantees at least completeness on all graphs.
DLS(node, goal, depth) { if (node == goal) return node; push_stack(node); while (stack is not empty) { node' := pop(stack); if (node'.depth() < depth) { stack := expand (node) DLS(node', goal, depth); } else // no operation } }
Since depthlimited search internally uses depthfirst search the space complexity is equivalent to that of normal depthfirst search.
Since depthlimited search internally uses depthfirstsearch the time complexity is equivalent to that of normal depthfirst search, and is O() where stands for the number of vertices and for the number of edges in the explored graph. Note that depthlimited search does not explore the entire graph, but just the part that lays within the specified bound.
Even though depthlimited search cannot follow infinitely long paths, nor can it get stuck in cycles, in general the algorithm is not complete since it does not find any solution that lies beyond the given search depth. But if you choose the maximum search depth to be greater than the depth of a solution the algorithm becomes complete.
Depthlimited search is not optimal. It still has the problem of depthfirst search that it first explores one path to its end, thereby possibly finding a solution that is more expensive than some solution in another path.
