Skip to the workspace
Pebellslearn by building
Flow & Matching  ›  Capstone Project

Capstone: Meridian's Dispatcher

45 minRun max flow, find the limiting cut in the final residual graph, and price the cheapest pipe worth widening — the whole section in one report

dsa / Capstone: Meridian's Dispatcher

Explore each scene at your own pace.

01 · Meridian's fixed shift roster

Meridian's fixed shift roster

Capstone: Meridian's Dispatcher

Definition
A dispatcher report combines maximum flow and minimum cut over one network: it computes how much can be moved, reads the limiting cut from the final residual graph, and picks the cheapest edge on that cut to widen. No new algorithm is needed, only the same residual graph queried again.
In plain words
At the end of a shift you ask three things of the same map: how much did we move, which pipes held us back, and which of those is cheapest to widen tomorrow. One calculation answers all of them.

In short: This section built four pieces — how much a network can carry, exactly which pipes are the reason it isn't more, a faster way to find the first number, and the cheapest way to move a fixed amount. The dispatcher puts the first two together into one end-of-shift report: run max flow, read the limiting cut straight out of the leftover residual graph, and price the cheapest pipe on that cut worth widening before tomorrow's shift. Nothing here is a new algorithm. It's the same residual graph, asked three questions instead of one.

Meridian's fixed shift roster

Two feeder docks, a shared hub, and a quieter side route through berth — four departures, two of them already pinched:

watch it move · graph

Widen costs, not shown here, ride along on each pipe for later. The run below only needs capacity.

Meridian's roster: two docks feed a shared hub, and dockB also has a quieter side route through berth. 6 nodes, 7 edges, directed. At depot.

1 / 6
Scene 1 of 6
Project context and further resources
You're building a piece ofMeridian — the dispatcher
This piece — dispatch_plan(): Runs the whole roster: how much ships, which pipes are the limiting cut, and which is cheapest to widen.
Scenario End of shift: how much actually moved, which pipes are the reason it wasn't more, and if there's budget for exactly one upgrade before tomorrow, which pipe buys the most.
dispatch_plan.py
Call the function you wrote — just like your app's frontend would. Edit the inputs and hit Call.
dispatch_plan(routes, source, sink) → dictThe full shift report: how much ships, which pipes are the limiting cut, and which is cheapest to widen.
try:
returned
Press Run to execute your code.
Press Check to run the tests for this lesson.
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.