Advanced Data Structures and Algorithms examination paper by the University of Oxford (2015) 2026-10-31
Examination dated 5 June 2015, Trinity term, University of Oxford. The public archive contains the paper as the member
2015-adsa.pdf of Lawrence Attachment.zip. The three original pages contain the cover and thirteen numbered subparts on amortized analysis, flow networks, and linear programming. Bipartite b-matching Created 2026-10-25 Updated 2026-10-31
For a bipartite graph with bipartition and nonnegative integer bounds , a bipartite b-matching is an edge subset whose degree of a vertex is at most at each . Taking gives a matching in a graph. To maximize , build a flow network with arcs of flow network edge capacity for , arcs of flow network edge capacity one for , and arcs of flow network edge capacity for . The integral max-flow theorem gives an integral optimum. Select precisely the middle arcs with flow one. Flow conservation identifies their endpoint degrees with the outside arc flows, and the flow value is . Conversely, every such edge subset supplies a feasible flow of that value. This proves the reduction and its optimality.
Braess's paradox 2026-10-14
Adding a link to a nonatomic traffic flow network can increase the equilibrium travel delay. Extra routes change the incentives defining a Wardrop equilibrium, so the new equilibrium need not retain an earlier good allocation. The system-optimal delay cannot worsen when the old allocation remains feasible; the paradox concerns selfish equilibrium.
Cut capacity Created 2026-10-07 Updated 2026-10-18
The cut capacity of , with the complement of a set, isOnly outward directed edges contribute; incoming and internal edges contribute nothing.[ref]
FordFulkerson.java. Algorithms, 4th edition by Robert Sedgewick and others; Sedgewick and Wayne, FordFulkerson.java, check method, lines 196–203: sum capacities only from the source side to its complement
Here is the accounting behind the bound, using nonnegative original edge amounts in a finite flow network. Sum the divergence of a flow over the vertices in :An edge with both endpoints in appears once with a plus sign at its tail and once with a minus sign at its head, so those contributions cancel. An outward edge appears only with a plus sign; an incoming edge appears only with a minus sign. Since , and every other vertex satisfies flow conservation, the left side is the flow value. ThusThe inequality uses two facts separately: each forward flow is at most its flow network edge capacity, and each backward flow is nonnegative. This is the weak duality bound underlying the max-flow min-cut theorem. It is an accounting proof, requiring no choice of augmenting paths.
For in the running example, explicitly add the two divergences of a flow:The internal edge cancels. The edge is a genuine original directed edge entering , so its flow is subtracted; this is different from a backward edge in a residual network. Its flow network edge capacity is neither added to nor subtracted from cut capacity, which remains .
Equality in the bound holds precisely when every outward edge is saturated and every incoming edge carries zero flow, becauseand every term is nonnegative. For the two outward edges are saturated and there are no incoming edges, so the gap is zero. For all outward edges are still saturated, but the incoming flow of gives a gap of . This explains exactly why the second cut of a flow network is not a minimum cut.
Cut of a flow network Created 2026-09-29 Updated 2026-10-18
A source-to-sink cut of a flow network is a partition of a set of the vertex set of a flow network, with and . Its cut capacity sums the flow network edge capacities of directed edges leaving .[ref]
Flows (author-hosted chapter preview). Graph Theory by Reinhard Diestel; Diestel, Flows, §6.2, printed p. 158: source-side partition and cut capacity
The side may contain any selection of the other vertices; its induced subgraph need not be a connected graph. For the five-edge flow network with flow network edge capacities , gives the partition of a set . Only and leave this side, so its cut capacity is . Choosing instead puts across the boundary in the incoming direction: its flow network edge capacity is excluded.
The left panel pairs a feasible flow of flow value with a cut of a flow network of cut capacity , proving that each is optimal. The right panel uses the same feasible flow but a different cut of a flow network: the outward flow is and the backward flow is , giving net flow . That cut capacity is , so it supplies a valid but less sharp bound. The dashed boundary marks a partition of a set, rather than an additional edge or a proposed route.
Divergence of a flow Created 2026-09-24 Updated 2026-10-18
The divergence of a flow at a vertex is net outward flow. For original nonnegative edge amounts and their signed net record, respectively,Positive divergence of a flow means net supply, negative divergence of a flow means net demand, and zero is flow conservation. This is the same sign convention as flow balance.
In the running example, the divergences of a flow at are . Adding the four divergences of a flow gives zero: every edge contributes positively at one endpoint and negatively at the other. In a finite flow network, this cancellation explains why net supply at equals net demand at .
Flow Created 2026-09-24 Updated 2026-10-18
In a finite directed graph with distinct source and sink vertices , a flow records an amount on each original directed edge. For a feasible flow in a flow network, these amounts satisfy the capacity constraints and flow conservation at every vertex other than .[ref]
FlowEdge.java. Algorithms, 4th edition by Robert Sedgewick and others; Sedgewick and Wayne, FlowEdge.java, class documentation and capacity/flow constructor: nonnegative amount on an original directed edge, bounded by capacity
The antisymmetric convention records signed net amounts instead:taking missing edge amounts as zero. The paired signs describe one net transfer, rather than two independent transfers.[ref]
Flows (author-hosted chapter preview). Graph Theory by Reinhard Diestel; Diestel, Flows, §6.2, conditions F1 and F2′, printed p. 158: antisymmetry and conservation at nonterminal vertices
For example, if separate original directed edges and carry and , their net amount is . This signed record loses the separate amounts: , would give the same net amount. When checking capacity constraints on actual edges, keep the original amounts or specify the signed bounds carefully; when summing flow conservation, either record gives the same divergence of a flow.
For the running flow network, choose the original edge amountsEvery capacity constraint holds. At , incoming flow equals outgoing flow ; at , incoming flow equals outgoing flow . This feasible flow has flow value , computed at or .
The total of all five edge amounts is , but the flow value is . A unit passing through several edges appears several times in that total. Concretely, route units along each of the directed paths and , and along . Their delivered amounts sum to , while their edge usages sum to . The cut of a flow network certifies that this delivery rate is already a maximum flow.
Flow conservation is useful because it makes a local ledger predict a global delivery rate: intermediate vertices only redistribute the resource. An additional network circulation can change the individual edge amounts without changing the flow value. Counting net delivery rather than total edge usage prevents such recirculation from masquerading as increased output.
Flow network Created 2026-09-24 Updated 2026-10-14
A flow network is a directed graph with distinct source and sink vertices and a nonnegative flow network edge capacity on each directed edge . In the finite setting here, every flow network edge capacity is a finite real number. A feasible flow assigns a nonnegative amount to each original directed edge, satisfies the capacity constraints, and obeys flow conservation at every other vertex:These are nonnegative arc amounts. The antisymmetric convention in flow instead records net amounts , taking a missing arc amount as zero. The two conventions express the same flow conservation; keeping them distinct makes backward residual network edges easier to interpret.
Think of vertices as routers, directed edges as communication links, flow network edge capacities as available bandwidth, and flow as a steady transmission rate. An intermediate router can distribute incoming traffic among outgoing links, but flow conservation prevents it from creating traffic. The maximum flow problem asks how much total traffic can pass from to , allowing several graph paths to share the work. The same flow network language models transportation and abstract resource allocation.[ref]
https://ocw.mit.edu/courses/6-854j-advanced-algorithms-fall-2008/4064d889e5033a9915327a777d12b592_notes_flow.pdf. Goemans, Network flows, introduction and maximum flow formulation
Our running flow network has vertices and exactly five directed edges, with flow network edge capacitiesThe cross edge lets traffic entering use spare capacity on . With this edge removed, the two separate graph paths can carry only ; including it will let the maximum flow reach . Thus a link's usefulness depends on the rest of the flow network, rather than just its own flow network edge capacity.
Fluid flow 2026-10-06
A fluid flow is motion described by a velocity field . The trajectories of fluid elements satisfy ; the mass density and other fields obey their conservation laws and constitutive equations. This physical motion differs from a flow on a flow network.
Matrix rounding with fixed margins 2026-10-25
A matrix of nonnegative rational numbers with integer row and column sums can be rounded entrywise up or down while preserving all those sums. Let and be its floor and fractional part. The residual row and column sums and are nonnegative integers. Build a flow network with source-to-row flow network edge capacities , row-to-column flow network edge capacities one where , and column-to-sink flow network edge capacities . The fractional parts supply a feasible flow saturating all source arcs. The integral max-flow theorem supplies an integral one of the same total value. If its middle-arc flows are , with where , then is the required matrix. This is a constructive polynomial-time algorithm; no multiplication by a common denominator is required.
Max-flow min-cut theorem Created 2026-09-24 Updated 2026-10-14
For a finite flow network with finite nonnegative real flow network edge capacities, the greatest strength of a flow of a feasible flow equals the least cut capacity of a source-to-sink cut of a flow network:For a maximum flow, the vertices reachable from the source in the residual network define a minimum cut whose outgoing original edges are saturated and whose incoming original edges carry zero flow.[ref]
https://courses.csail.mit.edu/6.854/21/Notes/n06-flow.html. Karger, MIT 6.854 Notes 6, maximum-flow optimality conditions
Why is a cut of a flow network an upper bound? Sum flow conservation on its source side . Internal edge contributions cancel, leavingOnly directed edges leaving contribute to cut capacity. Directed edges entering are subtracted in net flow, so adding their capacities to the upper bound would lose the intended bottleneck. This inequality is weak duality; the theorem says the bound is attained, an instance of strong duality. Its beauty is that a routing plan and a separating boundary independently witness each other's optimality.
In the running flow network, the two internal vertices give four possible source sides. For , the cut capacity is . For it is . For it is ; the incoming edge contributes nothing to that cut capacity. Finally, gives . Thus the minimum cut has cut capacity , matching the explicitly computed maximum flow.
Maximum flow of value five and two minimum-cut certificates
. Labels show flow/capacity on each directed edge. The shaded source sides give cuts of capacities three plus two and two plus one plus two, both equal to the flow value. Details.Ford and Fulkerson's 1956 paper opens with a railway-capacity question attributed there to T. Harris and proves a minimal-cut theorem as Theorem 1. Its original formulation uses graph paths carrying nonnegative amounts; the residual reachability certificate for maximum flow below gives the finite directed flow network proof used here.[ref]
https://doi.org/10.4153/CJM-1956-045-5. Ford and Fulkerson, Maximal Flow Through a Network, Canadian Journal of Mathematics 8 (1956), pp. 399–404
Maximum flow problem Created 2026-10-05 Updated 2026-10-20
The maximum flow problem maximises the strength of a flow from a source to a sink subject to flow conservation and flow network edge capacities. For the nonnegative arc amounts used in flow network, its objective is net outflow from the source:The equality follows by summing flow conservation over all internal vertices. Incoming source flow must be subtracted: merely circulating traffic through does not deliver more to . The max-flow min-cut theorem identifies the optimum with the least cut capacity of a cut of a flow network. A feasible flow and a cut of a flow network of equal value certify optimality without requiring a particular choice of augmenting paths.
For the five-edge flow network with flow network edge capacities , takeEvery capacity constraint holds with equality. Flow conservation at is , and at it is . The strength of a flow is , also entering . This flow consists of units on the graph path , on , and on . The cut of a flow network with source side has cut capacity , so no feasible flow can do better.
Even a seemingly poor first augmenting path , carrying , does not cause failure in this example. It leaves residual network capacity along and along . These two subsequent augmenting paths yield values , , and , and produce exactly the flow above. Backward residual network edges become essential in the unit-capacity example under residual network, where this same first choice blocks every unused forward route.
Discrete assignment is another reason to study maximum flow. Put unit-capacity edges from to job vertices, from each job to eligible worker vertices, and from workers to . An integral flow selects a matching in a graph: each job and worker participates at most once, and the strength of a flow counts assigned jobs. The integral max-flow theorem therefore turns maximum cardinality assignment into maximum flow. Minimizing assignment costs is the related assignment problem, modeled by minimum-cost flow.[ref]
https://ocw.mit.edu/courses/6-854j-advanced-algorithms-fall-2008/4064d889e5033a9915327a777d12b592_notes_flow.pdf. Goemans, Network flows, assignment formulation
Nonatomic congestion game 2026-10-14
In a nonatomic congestion game, a divisible population chooses resources whose costs depend on aggregate usage. Each individual has negligible size, so changing their choice does not alter those costs. For traffic on a flow network, strategies are routes and an equilibrium is a Wardrop equilibrium: every route with positive flow has minimum delay for its source-sink pair. This differs from a finite-player congestion game, where a deviation changes the load used to evaluate the deviator's new cost. Continuous nondecreasing link delays give a Beckmann potential whose minimizers are exactly the traffic equilibria.
Nonnegativity 2026-10-31
The condition that a real number is at least zero. A nonnegative flow in a directed flow network follows the specified orientation or has zero value; a negative algebraic solution would describe the opposite orientation instead.
Outdegree orientation criterion Created 2026-10-07 Updated 2026-10-14
A finite undirected graph can be oriented with outdegree at least an integer at every vertex if and only if every vertex subset is incident to at least distinct edges. The max-flow min-cut theorem and integral max-flow theorem prove sufficiency by assigning distinct edges to vertices through an incidence flow network; each assigned edge is oriented away from that vertex. Necessity follows by counting outgoing edges from .
Solutions to the paper dated 5 June 2015.[ref]
Advanced Data Structures and Algorithms examination paper by the University of Oxford (2015). Cover, formal code A10399W1; question pages 2–3
All thirteen numbered subparts are treated. The original cover and both question pages have been checked, including the directions and labels of the flow network diagram. The binary counter and decimal counter analyses use the conventional all-zero initial state; the effect of allowing a different initial state is stated explicitly.A flow network is a finite directed graph with nonnegative flow network edge capacities , together with distinct source and sink vertices . A feasible flow in the nonnegative directed-edge convention is a function satisfying the capacity constraints and flow conservation:Its flow value is the net outflow at the source,which equals the net inflow at the sink by flow conservation.
A cut of a flow network is a partition of a set with and . Its cut capacity counts only directed edges leaving :The net flow across the cut of a flow network subtracts flow on edges returning into , and equals .
For the following parts, a circulation with vertex demands has no exceptional source or sink in the original directed graph. Instead it satisfies net inflow minus net outflow equal to at every vertex. Thus positive demands consume flow, and negative demands supply flow.
Write flow balance using the positive-inflow conventionRemove the lower bounds on network flow by writing , where only is nonzero. Then , and its required flow balance isIn the order , the lower-bound contribution is , soThe resulting flow network edge capacities areAdd a new source with an edge of flow network edge capacity , and a new sink with edges and of flow network edge capacities and . A feasible flow saturating these new edges is equivalent to a solution for : ordinary flow conservation in the enlarged flow network produces exactly the residual supplies and demands above. All source and sink edges must be saturated, requiring flow value .
Extended flow network after removing the lower bound; labels show final flow divided by flow network edge capacity
. The auxiliary edges are blue. The displayed flow saturates the auxiliary source and sink edges, certifying that all adjusted demands are met. The original edge regains its four-unit lower bound only after this auxiliary problem is solved. Details.Start the Edmonds–Karp algorithm at zero flow. Repeated breadth-first search in the residual network permits the following shortest augmenting paths; when paths tie, choose the one through first.
| Step | Augmenting path | Added flow | Total flow value |
|---|---|---|---|
The first augmenting path has three edges. Once is saturated, the next shortest possibilities have four edges, so steps and respect the breadth-first search rule. Each augmentation adds the usual backward edges to the residual network, though these particular augmentations need only forward edges. Now is saturated, so no further augmenting path exists. The cut of a flow network with source side has cut capacity , proving that the obtained flow is a maximum flow.
The original-edge values for are in the order . Restore the lower bound to obtainAll original capacity constraints hold, and meets its lower bound. The net inflows at are respectivelyThe original network therefore admits a feasible circulation with vertex demands.
Past exam of the computer science course of the University of Oxford 2019 Algorithms 1 a Solution 2026-10-25
Use nonnegative amounts on the original directed edges of the flow network. A feasible flow is a function satisfying the capacity constraints and flow conservation at every internal vertex:Its flow value is net outflow at the source,Summing flow conservation shows that this is also net inflow at the sink. Subtracting incoming flow matters when the source has incoming edges.
An – cut of a flow network is a partition of a set with and . Its cut capacity is the total outward flow network edge capacity,Incoming edges do not contribute to this sum. Equivalently, one may use the antisymmetric net-flow convention, but the nonnegative arc convention above will also be used in the subsequent reductions.
Past exam of the computer science course of the University of Oxford 2019 Algorithms 1 c Solution 2026-10-25
A path-cycle matching is exactly an edge subset whose resulting subgraph has maximum degree at most two: every nontrivial connected component of a graph of this form is a graph path or a cycle in a graph. Thus the task is a bipartite b-matching problem with bound two at every vertex.
Find a bipartition , orient every original edge from to , and add a source and sink . Give each arc , for , flow network edge capacity two; each original arc flow network edge capacity one; and each arc , for , flow network edge capacity two. Compute an integral maximum flow and select the original edges whose flow is one. The integral max-flow theorem guarantees such an integral optimum.
By flow conservation, at most two selected edges touch each vertex, so they decompose into the required vertex-disjoint paths and cycles in a graph. Conversely, any permissible path-cycle matching gives a feasible flow: send one unit through its middle arc for each selected edge, with the outside arc amounts equal to the endpoint degrees. In both directions, the flow value equals the number of selected edges. Maximizing either quantity therefore maximizes the other.
The blue edges in this example form a four-cycle in a graph and a one-edge graph path; the dashed edge is unused. Their five units of flow are optimal: the two left vertices can each contribute at most two selected edges, and has only one incident edge.
The constructed flow network has vertices and arcs. A polynomial-time algorithm for maximum flow, such as the Edmonds–Karp algorithm, followed by a traversal of the selected subgraph, gives an efficient solution.




