Generator

Where the work goes, dense, fixed density, V = 512

Rendered here at the parameters it defaults to, with every essay that calls it — which is the same list as the blast radius of changing it.
Where the work goes, dense, fixed density, V = 512Each bar is one algorithm's counted work at V = 512, split into the four primitives. The published bounds describe whichever segment the author had in mind, and which segment dominates is a property of the graph rather than of the algorithm: Dijkstra's queue comparisons are 2.7% of its work here.adjacency scansrelaxationsqueue comparisonsvisitsBreadth-first132,912Dijkstra, all V queued330,440Dijkstra, binary heap204,687Bellman–Ford, all passes135,313,312Prim202,711Kruskal790,734V = 512, E = 66,200, dense, fixed densityevery segment counted exactly

Where the work goes, dense, fixed density, V = 512

Each bar is one algorithm's counted work at V = 512, split into the four primitives. The published bounds describe whichever segment the author had in mind, and which segment dominates is a property of the graph rather than of the algorithm: Dijkstra's queue comparisons are 2.7% of its work here.

Drawn at 700 × 318, wide on the page. Everything above is what work-components returns with no arguments; the caption is the generator's own, computed from the numbers in the drawing rather than written beside it.

8 essays call work-components. The drawing above is what it returns with no arguments at all; every call below passes it something, because a placement that passes nothing draws whichever member of the family the generator happens to default to rather than the one its essay argues about — which is what optcheck and figfill exist to catch.

Where it is called

Changing this generator changes every one of these figures.

10010³10³10⁴10⁵10⁶10⁷Vcounted workBreadth-firstDijkstra, binary heapDijkstra, all V queuedBellman–Ford, all passesV from 64 to 2048, sparse, fixed average degreework = scans + visits + relaxations + queue comparisons Two parameters

Counting on a graph

adjacency scansrelaxationsqueue comparisonsvisitsBreadth-first14,336Dijkstra, all V queued2,118,656Dijkstra, binary heap56,973Bellman–Ford, all passes50,309,120Prim64,884Kruskal74,008V = 2048, E = 6,144, sparse, fixed average degreeevery segment counted exactly Two parameters

The queue decides the class, and the pseudocode does not name it

10³10⁴11010010³npointer hops per findneitherpath compressionunion by rankboth3n random unions, seededα(n) ≤ 4 for every n on this axis Two parameters

The constant that is practically constant

10010³10³10⁴10⁵10⁶10⁷Vcounted workTopological order, one passDijkstra, binary heapBellman–Ford, all passesV from 64 to 2048, directed, acyclicwork = scans + visits + relaxations + queue comparisons Two parameters

The precondition that removes the queue

adjacency scansrelaxationsqueue comparisonsvisitsKosaraju, two passes5,632Tarjan, one pass2,560V = 1024, E = 1,536, directed, components plantedevery segment counted exactly Two parameters

Two passes or one, and what the second one costs

10³10³10⁴Vmodelled missesadjacency listCSR array96% miss27% miss64 lines × 8 elements, fully associative, LRU3.6× between two layouts of one graph Two parameters

A list and a block of memory

10010³10³10⁴10⁵10⁶10⁷Vcounted workBreadth-firstDijkstra, binary heapBellman–FordBellman–Ford, all passesV from 64 to 2048, sparse, fixed average degreework = scans + visits + relaxations + queue comparisons Two parameters

The bound with a precondition

24816326410⁵10⁶components the graph is built fromcounted workcomponents firstBellman–Ford, early exitBellman–Ford, every passV = 1,024, negative arcs between componentsvertices relabelled at random Two parameters

A graph is as hard as its largest cycle

The library, page 5 of 5 — where work-components sits