A robot route described as “shortest” still needs an objective. The fewest graph transitions, the smallest sum of distances, and the smallest sum of modeled travel times can select different paths. A search method can answer its stated mathematical question correctly while answering a different question from the one a reader intended.

The distinction becomes visible before considering heuristic estimates. Breadth-first search organizes exploration by the number of edges from the start. Dijkstra's algorithm organizes it by accumulated edge cost. Neither can infer what an unlabeled edge was supposed to mean.

UC Berkeley's CS188 textbook describes the FIFO frontier of breadth-first search and the cost-priority frontier of uniform-cost search, relating the latter to Dijkstra. NetworkX's official Dijkstra documentation defines path distance through sums of numerical edge weights. The following finite graph and representation experiment are original hypothetical examples, not a robot deployment or software benchmark.

One graph, two valid answers

Consider a directed graph with start S and goal G. All edge costs are positive numbers in a declared abstract cost unit. The complete edge list is:

S to G: cost 12.

S to A: cost 2.

A to B: cost 2.

B to G: cost 2.

S to C: cost 1.

C to G: cost 9.

There are no other edges. Thus the available complete routes are S–G, S–A–B–G, and S–C–G. Their respective edge counts are one, three, and two. Their accumulated costs are 12, 6, and 10.

Breadth-first search selects S–G as the shallowest goal path. It contains the fewest transitions. That conclusion does not require a misleading tie: there is only one one-edge route to the goal. The algorithm's depth ordering gives no preference to the cheaper three-edge route.

For this graph, a standard breadth-first graph search with a FIFO frontier and visited-state bookkeeping returns a minimum-edge path. Its answer is perfectly consistent with that objective. Calling its cost of 12 “minimum travel cost” would add a claim that the search did not establish.

Follow accumulated cost instead

Now use Dijkstra with a best-known cost for each vertex, numerical edge relaxation, and a minimum-priority frontier. Ignore obsolete frontier entries. Stop when G is removed with its current best cost and settled, rather than when G is first discovered.

After expanding S, the tentative costs are C = 1, A = 2, and G = 12. C is next because 1 is smallest. Its edge proposes G = 1 + 9 = 10, improving the previous value.

A is then removed at cost 2 and proposes B = 4. B is removed at cost 4 and proposes G = 6. G is finally settled at 6, yielding S–A–B–G.

The early discovery of G at 12 did not certify that value. The frontier still contained cheaper partial routes capable of reaching G. On this finite graph, nonnegative weights make the settlement ordering support the minimum-cost conclusion. Negative weights would invalidate that general reasoning; they are excluded here.

The objective changes the result, even though the vertices, edges, and arithmetic are identical. No estimated distance to the goal is involved.

Change the drawing without changing a route's cost

A second experiment exposes how edge count depends on graph representation. Replace the direct S–G edge with four directed edges through new intermediate vertices P, Q, and R:

S to P, P to Q, Q to R, and R to G each have cost 3.

These vertices are bookkeeping subdivisions with no branches or additional constraints. The subdivided route still costs 3 + 3 + 3 + 3 = 12. The other two routes retain their original costs and edge counts.

Dijkstra still selects the cost-6 route through A and B. Breadth-first search now selects S–C–G, which has two edges. Its cost is 10. The direct physical connection, represented by four subdivisions, no longer wins the minimum-edge objective.

Thus breadth-first search changes from cost 12 to cost 10 solely because one route gained intermediate representation points. The least-cost route remains cost 6 in both graphs.

This is not a numerical error. Counting edges measures something about the chosen graph. It measures physical travel only when the construction of those edges makes that interpretation valid.

When the two objectives agree

If every edge has the same strictly positive cost k, a path with n edges costs nk. Minimizing n also minimizes nk, so a minimum-edge path is a minimum-cost path. Equal edge costs provide the bridge between the objectives.

Equal drawing lengths, identical vertex symbols, or a regular-looking map do not establish equal modeled costs. A graph can contain transitions with different durations or distances even when its visual layout looks uniform.

Conversely, an edge might intentionally represent a fixed transaction such as one abstract state transition. In that model, counting transitions can be the desired objective. The important step is preserving the relationship between the modeled event and the cost being minimized.

A fixed overhead per transition illustrates the same issue. If the overhead represents a real action, adding it can be meaningful. If dummy subdivision vertices create extra overhead charges without creating extra actions, the model itself has changed. A search algorithm cannot correct that semantic mismatch.

Weights need explicit meaning

NetworkX documents that its default named weight lookup assigns a weight of one when that edge attribute is missing. This is a useful example of why a weighted-search function name alone does not prove that intended costs reached the algorithm. This article does not claim to have executed that library or inspected any robot graph.

A path cost also needs compatible units. Adding meters on one edge to seconds on another does not create a defined physical quantity without an explicit conversion or objective model.

The narrow result is about graph optimization. A minimum-cost path in an abstract graph does not by itself establish geometric clearance, feasible motion, or a reliable travel-time prediction. It establishes the best sum under the graph and costs supplied. Understanding that scope makes “shortest route” a statement that can actually be checked.

Sources checked October 23, 2026: UC Berkeley CS188, Introduction to Artificial Intelligence, section 1.3 Uninformed Search, web edition as accessed; no revision date inferred: https://inst.eecs.berkeley.edu/~cs188/textbook/search/uninformed.html

NetworkX 3.7 documentation, single_source_dijkstra, stable page as displayed on the check date: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.shortest_paths.weighted.single_source_dijkstra.html

Illustration note: A generic robot or navigation concept image may accompany this explanation. It does not depict the invented graph, validate route costs, or document a tested navigation system.