PrepStack · Markdown HTML

Minimax / bottleneck Dijkstra

Ordered frontier and path · HTML

Formal shape

effort[v]=min over paths P of max step cost on P. Extending u to v gives cand=max(effort[u], step_cost(u,v)); retain the smaller label.

Recognition signals

False friends

SignalWhy it is different
Maximize the minimum edgeThat is a maximin or widest-path direction; comparisons and heap direction must change.
Minimum total costWhen every step accumulates, use additive Dijkstra instead.

Core invariant

A fresh minimum-effort pop is final because extending any pending path cannot lower its bottleneck below its current frontier label.

State, transition, and processing order

ItemDefinition
Statebest[v], the smallest bottleneck known to v, and heap labels (bottleneck,node).
TransitionCompute cand=max(current, edge_or_vertex_cost); if cand<best[v], update and push.
Frontier / orderA min-heap ordered by current bottleneck, expanding prefixes with the lowest achievable threshold first.

Python skeleton

import heapq

def minimax_path(graph, start, goal):
    best = {start: 0}
    heap = [(0, start)]
    while heap:
        effort, u = heapq.heappop(heap)
        if effort != best.get(u):
            continue
        if u == goal:
            return effort
        for v, step_cost in graph.get(u, []):
            cand = max(effort, step_cost)
            if cand < best.get(v, float('inf')):
                best[v] = cand
                heapq.heappush(heap, (cand, v))
    return float('inf')

Correctness sketch

  1. Max is monotone under extension: appending a step can never reduce a path's bottleneck.
  2. If a fresh minimum label u were not optimal, the first unsettled vertex on a better route would follow a settled predecessor that should have generated a lower candidate, contradiction.
  3. The relaxation exactly computes the bottleneck of a path extended through u, preserving every possible improvement.

Complexity

TimeSpaceParameters
O(E log V) in the standard model; O(E log E) is valid for a lazy heapO(V+E) worst caseV and E describe the state graph; every successful relaxation creates one heap label.

Edge cases

Error patterns

PatternWhy it fails / fix
Using the wrong step metricstep_cost must match the bottleneck definition: edge difference, vertex height, and capacity are not interchangeable.
Pushing only when cand growsRelaxation asks whether cand is smaller than best[v], not whether it exceeds the current path label.
Wrong source labelA vertex-weight model commonly includes the source's own cost.

Selection and exclusion rules

RelationTemplateBoundary

Original micro-example

PartDetail
ResultChoose the second route for minimax value 5.
SetupTwo routes have step costs [2,9,1] and [5,5,5].
TraceTheir bottlenecks are 9 and 5; neither length nor sum is the score.

Recall prompts

My notes