6

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

      }
     }
Rowhawn
  • 1,409
  • 1
  • 16
  • 25

2 Answers2

3

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.

Lily Ballard
  • 182,031
  • 33
  • 381
  • 347
  • I see. Do you think you could point me in the direction of a better example? I can't seem to find very much regarding depth-limited searches outside of Wikipedia. – Rowhawn Feb 11 '11 at 02:17
  • It sounds like it's just a simple depth-first search that keeps track of the depth and stops recursing once it hits a certain limit. It should be fairly trivial to modify an existing recursion-based depth-first search to behave the same way. – Lily Ballard Feb 11 '11 at 03:15
0

"expand a node" means to discover a nodes children

Kieren Dixon
  • 947
  • 10
  • 9