扩展节点是什么意思?
我试图了解维基百科上的深度有限搜索算法,并且我试图弄清楚扩展节点到底意味着什么。我试图寻找答案,但我得到的只是更多的算法,这些算法表明节点必须扩展。
具体来说,stack := Expand (node)
行对于整个函数来说意味着什么?
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
}
}
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
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这种情况下,它将节点的所有子节点作为新堆栈返回。不过,这是一段写得非常糟糕的示例代码。
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