Uniform Cost Search (UCS) traverses nodes by the shortest cost.
Here’s an example of a map with a starting point from Las Vegas to the goal point Calgary.
I’ve marked up the depth levels by arrow color. To determine the order, I needed to find the shortest cost between nodes. It helped me make a tree on paper:
I followed the cost path to output the order of visits:
Las Vegas, Los Angeles, Salt Lake City, San Francisco, Phoenix, Denver, Helena, El Paso, Santa Fe, Portland, Seattle, Omaha, Kansas City, Calgary
Sources: Wikipedia, ColumbiaX