What does it mean to expand a node?
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 st开发者_运维技巧ack := 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
}
}
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.
"expand a node" means to discover a nodes children
精彩评论