For a uniform cost search, would C expand D first as is the cheapest or G because is the goal?
The rule is normally that uniform cost search would expand the cheapest node, however G is the goal and also totally it would be the lowest cost?
For a uniform cost search, would C expand D first as is the cheapest or G because is the goal?
The rule is normally that uniform cost search would expand the cheapest node, however G is the goal and also totally it would be the lowest cost?
In this case you have found the goal with cost 4. But, imagine if there was an edge with cost 0.5 from D to G. Then, you would need to continue to find a path cost 3.5 from S-A-C-D-G. If you stopped as soon as you found the goal below C, you would get a suboptimal solution result.
However, if you know the minimum edge cost is 1 then you could stop, because the best path through D would have cost 4, which is the same as the path S-A-C-G.
The main point here is that you can't stop until you've proven that every path you are exploring is going to be at least as expensive as the best solution found so far.