Choose a strict total order of the vertices of a finite simple graph. Direct every edge from to when . Along every directed path, the index strictly increases. Returning to the starting vertex would require an impossible strict increase back to the initial index, so this is an acyclic orientation. The displayed comes from .
The chosen strict total order is a topological order of the resulting Directed acyclic graph. Conversely, every acyclic orientation of a finite simple graph has a topological order, and orienting its edges from earlier to later in that order recovers it. Different topological orders can induce the same acyclic orientation, since vertices with no edge between them need not impose a choice of arrow.[ref]
An order respects reachability but does not create it: in a chosen topological order does not imply a directed path from to . For example, orient the two edges of the graph path using . The arrows are and ; there is no directed path from to , despite . In , however, reaches both directly and via . Following outgoing directed edges with graph search decides this directional reachability.[ref]
The all-to-one shortest path problem asks for the minimum length of a directed path from every vertex to the root , with and if no such directed path exists. Positive directed edge lengths allow directed cycles to be deleted, so a shortest directed path, when one exists, uses at most directed edges. Its optimality equations are
A Bellman-Ford algorithm initializes and other labels to infinity, then repeats
keeping the root label zero. Induction on proves that is the least length among directed paths using at most directed edges: either the old best directed path remains, or the first directed edge is followed by a directed path with at most directed edges. Thus rounds give the exact distances. An in-place variant repeatedly relaxes ; each decreased label triggers further incoming-arc relaxations. It terminates when no finite label can improve. The Bellman inequalities then telescope along each directed path to show the labels are lower bounds on all directed path lengths, while every finite label represents a discovered directed path and is an upper bound on the optimum. This proves correctness. The method is a label-correcting shortest-path algorithm: a processed label can be revised many times. Full scans cost .
Let and choose attaining it. Every directed path from a nonroot vertex to has a final directed edge costing at least , and all preceding directed edges have positive lengths. Therefore every . The direct directed edge from to has length , so
If no incoming root directed edge exists, all these distances are infinite and there is no finite next vertex to settle.
The all-to-one Dijkstra algorithm sets the root's label to zero and all others to infinity. Repeatedly choose an unsettled vertex with least finite label, make that label permanent, and relax every incoming directed edge of an unsettled vertex:
Store the corresponding successor whenever the label improves. Stop when all vertices are settled or every remaining label is infinite. This applies the usual source version to the reversed graph; relaxing outgoing original directed edges would solve the wrong direction of the problem.
For its correctness, inductively assume every settled distance is exact. Any directed path from an unsettled vertex to the root must first enter the settled set at some vertex , through an directed edge . That directed edge has already been relaxed, so . The newly selected label is no greater than . The directed path's preceding nonnegative lengths therefore make its total length at least . On the other hand, itself is the length of a discovered directed path. Hence , and it can never need correction. This is a label-setting shortest-path algorithm. Straight array selection costs .
For four vertices and root 4, the full symbolic execution is as follows. After settling 4, the tentative labels are . Select
set , and update the two other labels to . Select the smaller of those labels at vertex , set , then for the last vertex set
The stored successors give the corresponding shortest routes; infinity conventions handle missing directed edges and disconnected vertices.
The supplied PDF contains no visible network diagram or directed edge lengths in the space for this example, and the converted TeX omits the diagram as well. Numerical distances and route choices cannot be determined from the supplied data. The symbolic run above gives the exact four-node calculation once those lengths are available; no network has been guessed.
Both alternatives can be proved. For the oriented tree alternative take ; at the displayed tournament order is zero, so that unqualified boundary case cannot be intended.
Choose a median order of a tournament , maximizing its number of forward directed edges. Every interval inherits a median order, since improving that interval would improve the whole order. If had fewer outneighbours than inneighbours in , moving it just past would increase the number of forward directed edges. Hence it has at least half the vertices of that later interval as outneighbours.
Call a graph embedding half-sparse if every proper final interval satisfies . This half-sparse median-order embedding admits a useful extension. Suppose an outward leaf is attached to a vertex mapped to , and reserve two extra vertices at the end of the tournament order. In the old interval after , half-sparsity bounds the number of occupied vertices by less than half its size plus one. The interval extended by two vertices has at least that half-size plus one outneighbours of . Thus at least one outneighbour is free; map the new leaf there. Every old final interval has gained two available places and at most one new image, so its strict inequality persists. Final intervals wholly within the two new places contain at most one image, so they also satisfy the inequality. This proves the extension, not just an existence assertion about degrees.
Starting with an directed edge in a two-vertex tournament and repeatedly attaching outward leaves proves that every -vertex arborescence embeds half-sparsely in every -vertex tournament for . The root-first construction supplies the induction. An unused suffix can be appended without destroying the inequality; for a suffix which contains the whole old order the extra place supplies the needed strictness. A singleton embeds half-sparsely in the first vertex of a two-vertex order. Reversing the oriented tree and tournament gives ordinary embeddings of reversed arborescences in vertices as well.
Here is the stronger invariant needed for an arbitrary oriented tree. Root it at a source. Classify each directed edge as forward or backward according to whether it points away from or towards the root in the underlying rooted tree. Let be the number of backward directed edges and the number of nonempty connected components made of these directed edges, ignoring isolated vertices. Put . We claim that the oriented tree has a half-sparse embedding in every median-ordered tournament of order .
Induct on the oriented tree order. If it has a forward leaf, delete that leaf, use the induction hypothesis and apply the two-place extension. Neither nor changes. If there are no backward directed edges, use the arborescence construction. Otherwise first remove forward leaves as above, so every remaining leaf is backward. Choose a backward component furthest from the root. It must be a pendant subtree: a forward continuation below it would either reach another backward component, contrary to its choice, or end at a forward leaf. Let this component have vertices and top vertex . Since the root is a source, is not the root; its joining directed edge from its parent is forward. The component is an reversed arborescence rooted at .
Delete the component. The remaining oriented tree has parameters
Its required tournament order is . Embed it in the initial interval of this length. Temporarily attach outward leaves at , using the extension lemma repeatedly. This consumes exactly extra places and gives a half-sparse embedding of the enlarged oriented tree in the original tournament. The temporary images all lie in the outneighbourhood of ; among them embed the deleted reversed arborescence. Its root automatically receives the joining directed edge from . Replace the temporary leaves by this component. The final image is a subset of the temporary enlarged image, so half-sparsity survives. This proves the invariant with the precise count, including the case when the remaining oriented tree is a singleton.
Unless the oriented tree is already an in- or out-arborescence, every rooting has at least one backward component. Choose one orientation, reversing all directed edges if necessary, so that some rooting has at most backward directed edges. It then has . Within this fixed orientation choose the root to minimize lexicographically. If a neighbour pointed into the root, move the root across that directed edge. Only this directed edge changes its forward/backward classification. Removing it from the backward forest decreases by one and decreases by at most one; hence it cannot increase , and when stays equal it strictly decreases . This contradicts the chosen minimum. Thus the chosen root is a source, while its retains the required bound. Reversal does not affect a universal tournament-embedding assertion, because one reverses the host tournament too. The invariant proves the three-times-order tournament bound for oriented trees:
For the lower obstruction, take the outward graph star with leaves. There is a regular tournament on vertices: on residues modulo , direct when is one of . Every vertex has outdegree , so none can be the centre of that outward star. Thus the universal bound cannot be reduced to .
For the strongly connected directed graph alternative, the correct universal assertion is an upper bound by the independence number, together with examples needing that many directed circuits. The literal assertion that every such graph needs directed circuits is false: a directed four-cycle has independence number two and is spanned by one directed circuit. Work with a nontrivial strongly connected digraph; a loopless singleton has no directed circuit.
Use the permitted coherent cyclic order of a digraph. Representatives differ by cyclic rotations and swaps of consecutive nonadjacent vertices. In every representative, a backward directed edge has a forward directed path from to . A directed circuit with one backward directed edge winds once around the order. Every vertex belongs to such a directed circuit, because every vertex has an outgoing directed edge and coherence puts that directed edge on a once-winding directed circuit. Let be the cyclic stability of a digraph order: the largest size of an independent set consecutive in an equivalent order. Then .
We need a short ordering lemma. If a set has no forward path between distinct members, then . Among equivalent representatives retaining this property, minimize the span from its first to its last member. Suppose there is a vertex in a gap. If some gap vertex cannot be reached from an earlier member of by a forward path, take the first such . Every preceding gap vertex in the span is reachable from an earlier member of . It follows that has no forward incoming directed edge from anywhere in that part of the span; a backward outgoing directed edge to it is also impossible, since coherence would supply the same forbidden forward reachability. Thus is nonadjacent to every intervening vertex and can be moved before the first member of , shortening the span. Otherwise every gap vertex is reachable from an earlier member of . Take the last one. It cannot have a forward path to a later member of , and coherence consequently rules out directed edges in either direction to the following members of . Move it past them, again shortening the span. Swaps of nonadjacent vertices do not change the forward-edge graph, so these moves preserve the hypothesis. Both cases contradict minimality. Therefore is consecutive. It is independent: a forward directed edge is forbidden by hypothesis, and a backward directed edge would imply a forward path by coherence. Rotate it to the start to obtain .
Choose a representative starting with a stable block . Add sink copies , retain all forward directed edges of , and add for each original directed edge . This is an acyclic auxiliary directed graph . A once-winding directed circuit through cannot visit another block member, since no forward path can join two members of this initial independent block. Opening this directed circuit gives a path from to in .
The partial order defined by reachability in has width exactly . The sink copies already form an antichain of size . For the reverse inequality, let be an antichain and let index its sink copies. Permute the independent initial block so that these labels come first, then rotate that part of the block to the end. The set
has size : a vertex and its own copy cannot both belong to , since they are comparable by the opened directed circuit. There is no forward path between distinct members of in the rotated order. A path between original members would give comparability in ; a path from an original member to would become a path to its sink copy, also forbidden. No forward path leaves the final stable block. The ordering lemma therefore gives .
Apply the Dilworth theorem to partition this reachability order into chains in a partial order. Each chain contains exactly one original block vertex and exactly one sink copy, since each of these two antichains has size ; these are its first and last elements. Expand consecutive chain relations into directed paths in . The paths cover all vertices, though intervening vertices can occur on several paths. Label their heads and their tails ; the tail labels define a permutation .
Among all such covering path families maximize the number of cycles of . If two paths whose labels lie in the same permutation cycle meet at a vertex, exchange their suffixes there. The paths remain simple, since the auxiliary graph is acyclic, and their union still covers the same vertices. Exchanging the two tail labels splits that permutation cycle into two, a contradiction. Thus paths in the same permutation cycle are disjoint. Identify every with and concatenate the paths around each cycle of . Each concatenation is a genuine directed circuit, with no repeated vertex except its closing vertex. Together these directed circuits cover , and there are at most of them. This proves the circuit-cover bound by independence number:
Finally, form directed triangles sharing just one central vertex, with no directed edges between their other vertices. This strongly connected directed graph has independence number , by taking one outer vertex from each triangle. A simple directed circuit can use only one triangle, since visiting a second requires repeating the centre. Exactly directed circuits are therefore necessary. The bound is sharp in general; is not a universal bound.
Use the incoming-edge coupling of site and bond percolation. Start with independent random variables indicating open bonds, each with probability . For a vertex of incoming degree , let indicate that at least one incoming bond is open. Then
The indicators are independent: the sets of bonds entering different vertices are disjoint. Using an additional independent coin at each vertex, turn some zeros into ones so that the resulting indicators are independent with common probability . Explicitly, when , set with conditional probability .
Every vertex other than in an open bond percolation out-cluster has an open incoming bond, and is consequently an open site. On , the whole bond out-cluster is therefore contained in the site percolation out-cluster. The event of infinite bond reachability does not depend on bonds entering : delete cycles from any finite open directed path starting at . It is thus independent of , including its additional coin. Hence
For every below , monotonicity and the definition of the survival threshold give . Letting yields the quantitative bound
In particular, if , the right-hand side is strictly less than . If , no separation from is implied or generally possible.
Robbins' theorem 2026-10-14
A finite nonempty connected graph whose edges are undirected admits a strong orientation if and only if it has no bridge in a graph. This statement holds for finite multigraphs as well as finite simple graphs; self-loops do not help connect distinct vertices. The single-vertex case is allowed, with length-zero directed paths.[ref]
Necessity comes from the two sides separated by deleting a bridge in a graph: its chosen arrow crosses in only one direction. For sufficiency, the cited constructive proof uses depth-first search to find a cycle in a graph, orients it cyclically, contracts it, and repeats. Undoing the contractions replaces junctions by directed cycles, retaining two-way reachability. Contraction can produce multiple edges, so these must remain distinct. This is a construction outline; the input graph is finite and bridgeless, and remaining edges within contracted pieces can receive arbitrary directions.[ref]
Shortest-path predecessor 2026-10-14
A shortest-path predecessor records the previous vertex on a chosen route from source to . When edge relaxation strictly improves through , set . For a multigraph, store the actual directed edge, since two edges with the same endpoints can have different weights. Initialize all vertices, including the source, without a shortest-path predecessor. The authored implementation reconstructs a route by following these incoming edges backwards, then reversing their order.[ref]
At the end of the edge relaxation trace, , , and . Following them gives , so the forward directed path is , of cost . This makes the distance useful: a number tells us the best cost, whereas the shortest-path predecessors tell us which connections to take. In the Dijkstra algorithm, reconstruct a destination's shortest route after its label becomes permanent. In a label-correcting shortest-path algorithm, wait for convergence and the appropriate negative-cost directed cycle check. During correction, a predecessor's label may have changed since its child's last update: immediately after in the trace, the current chain to costs although still records the earlier discovered route of cost .
Strict improvement is a useful guard against directed cycles in the recorded pointers. Consider and of cost zero, followed by and , also of cost zero. After the first two edge relaxations, both labels are zero and both shortest-path predecessors are . If equality also allows pointer replacement, the last two operations can set and : following pointers loops forever despite correct distance labels. Keeping the old pointer on ties prevents this example; choosing among equal-cost routes requires a separate rule that preserves a route to the source. Strict improvement alone does not protect against reachable negative-cost directed cycles, which can force endless decreases. Equality on recorded edges plus the Bellman inequalities certifies route costs only when the pointer chains actually terminate at the source.
For all-to-one distances to , record a next vertex whenever relaxing improves . Follow these successors forward in the original directed graph to reach . They are shortest-path predecessors when viewed in the reversed directed graph; keeping the direction convention explicit prevents returning a route whose arrows point the wrong way.
A spreadsheet cell depends on itself along a nonempty directed path. For a separate formula-edit experiment, restore the initial inputs and replace only B1 by =A1+A2+C1. Now B1 C1 B1 is a directed cycle. Requesting D1 makes D1,C1,B1 active and then requests the still-active C1; the algorithm reports C1,B1,C1 rather than returning an old value. This witness follows references backwards, opposite to our dependency arrows; reversing it gives a directed cycle in the spreadsheet dependency graph.
D1 is not itself on that directed cycle, but it cannot receive a value from this evaluator because it needs C1. Independent requests for B2 and E1 still succeed. A topological order of the entire modified spreadsheet dependency graph is impossible: the two cyclic directed edges would require B1 before C1 and C1 before B1. For the initial inputs, the associated system of linear equations is even inconsistent: and imply . Detecting a directed cycle is a structural check, not an attempt to solve these linear equations.