Skip to main content
metroplafond

Network flow: a powerful tool for modelling problems

November 1st, 2019
ALGORITHMS

Network flow is part of the graph theory toolbox, used to model transportation networks, scheduling, and resource matching. With today's libraries, a simple method call solves the optimisation — the hard part is modelling the problem correctly.

From unique paths to bipartite matching

Given a graph, finding unique (edge-disjoint) paths from node i to j is solved by setting each edge capacity to 1 and running maximum flow. For node-disjoint paths, duplicate every node into k and k' with capacity-1 edges between them. For employee-project matching: connect source to employees, employees to matching projects (based on skill requirements), and projects to sink. Set all edges to capacity 1. Maximum flow gives the optimal matching.

Extending with real-world constraints

Real problems have additional constraints: employee seniority ranks, project difficulty levels, budget limits. We modelled this with edge capacities equal to wages, source-to-worker edges based on simultaneous project capacity, and project-to-sink edges capped at project budget. Running max-flow-min-cost with networkx and filtering unsaturated edges gives budget-respecting assignments. — Armando

metroplafond
Facing optimisation challenges?

LET'S TALK

Network Flow Algorithms for Modelling | Arinti