0
$\begingroup$

I am working on a problem where I have a set of goal nodes of which some, all, or none of will appear in a search tree.

Is there a search algorithm which returns the lowest cost path to one goal node, when there are potentially many different goal nodes present in a tree, or failure?

This can obviously be solved by iterating through the set of goal nodes and applying a search algorithm on each of the goals and then comparing the paths to find the lowest cost path, but I would like know if there is a more elegant solution.

Thanks

$\endgroup$
1
$\begingroup$

Yes, any of the standard search algorithms will do that.

You seem to be under the misapprehension that search algorithms stop "when they reach node $x$." They don't: they stop when they reach a node with any property you tell them to use. That property could be "node $x$", or "any node in $x_1, \dots, x_k$", or "any node with score more than $10$" or any other condition you choose.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.