I'm trying to understand the algorithm for a Depth-Limited-Search on wikipedia, and I'm trying to figure out what exactly it means to expand a node. I attempted to search for an answer but all I got was more algorithms which state that nodes must be expanded.
Specifically, what is the line stack := expand (node)
saying in regards to the whole function?
DLS(node, goal, depth)
{
if (node == goal)
return node;
push_stack(node);
while (stack is not empty)
{
if (depth > 0)
{
stack := expand (node)
node = stack.pop();
DLS(node, goal, depth-1);
}
else
// no operation
}
}
Here depth-first search and breadth-first search expand every node, whereas A* search expands 4 nodes.
After the selection phase, when a leaf node is reached, the tree is expanded in the so-called expansion phase.
• General approach: best-first search; an instance of TREE- SEARCH (or GRAPH-SEARCH) – where a search strategy is defined by picking the order of node expansion. • With best-first, node is selected for expansion based on evaluation function f(n).
Use TreeNode. Expand() on every node from the root to the leaf you wanted to be expanded, using Expand on the leaf node or the node you want to expand make only the node itself to show its subchildren.
In this context, it returns all the children of the node as a new stack. This is a very poorly-written bit of sample code though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With