Bipartite b-matching 2026-10-25
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.
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.
Path-cycle matching 2026-10-24
A path-cycle matching in a finite simple graph is a collection of mutually vertex-disjoint paths and cycles in a graph. Its used edges form a subgraph with every degree of a vertex at most two. Conversely, every finite connected component of a graph with maximum degree at most two is a graph path, a cycle in a graph, or an isolated vertex; following successive edges proves this classification. Discarding unused isolated vertices therefore converts any such subgraph into a path-cycle matching without changing its edge count. On a bipartite graph, maximizing the used edges is exactly bipartite b-matching with every .
