# What does the statement with the max do in the recursive best-first search algorithm?

I am reading the book "Artificial Intelligence: A Modern Approach" by Stuart and Norvig. I'm having trouble understanding a step of the recursive best-first search (RBFS) algorithm.

Here's the pseudocode.

What does the line s.f <- max(s.g + s.h, node.f) do?

Here's a diagram of the execution of RBFS.

• You don't understand only the line s.f <- max(s.g + s.h, node.f) or all the algorithm?
– nbro
Mar 20 '20 at 2:07
• Only the specific line. Mar 20 '20 at 2:39
• I've edited your post to make it clearer then. Make sure that's still consistent with your original intent.
– nbro
Mar 20 '20 at 3:02
• It is computing the cost for the successors, it will be max of the current incurred cost (node.f) or sum of s.g and s.h (as far as I remember, it is the edge cost+estimate cost to goal, I am not sure, the book might have used a similar notation before) Mar 20 '20 at 11:46