Bipartite graph Created 2026-09-24 Updated 2026-10-14
A bipartite graph separates its vertices into two independent sets: every edge goes from one part to the other. Here is a finite simple graph and an undirected graph, with no self-loops and no repeated edges. The two parts satisfyThus neither part contains an edge. The parts need not have equal sizes, and some pairs across them may have no edge; requiring every cross pair gives a complete bipartite graph. The independent set and cross-edge definitions are equivalent.[ref]
The Basics (author-hosted chapter preview). Section 1.1, printed p. 3, independent vertices; Section 1.6, printed p. 17, bipartite and complete multipartite graphs
For example, the six-vertex cycle graph with edges has parts and . Drawing the same graph as a hexagon or in two columns changes neither its edges nor its bipartite property. An extra isolated vertex can go in either part.
We allow either part to be empty. Consequently a graph with no edges is bipartite, even when ; choose , . Here "two colours" means two colours are available, with no requirement to use both. This convention explicitly includes the empty case, whereas definitions requiring two nonempty classes need an exception. For several connected components of a graph, choose the two parts separately in each graph component and take their unions. In a nonempty connected graph that is bipartite, fixing one vertex's colour forces all others along graph paths, so its two-colour assignment is unique up to swapping the colours. Each graph component, including an isolated vertex, can be swapped independently.
The two-colourability criterion for bipartite graphs identifies these parts with the colour classes of a proper vertex colouring: assign colour to and colour to , so adjacent vertices have different colours. More surprisingly, the odd-cycle characterization of bipartite graphs turns a global requirement into one precise obstruction:This statement is for the finite undirected graph and simple graph model above; a graph cycle has distinct vertices except for the repeated starting vertex. Along a graph cycle in a bipartite graph, colours alternate, so returning to the starting colour takes an even number of edges. Therefore any odd cycle, whether or not other edges join its vertices, prevents a bipartite split.[ref]
The Basics (author-hosted chapter preview). Section 1.6, Proposition 1.6.1 and proof, printed pp. 17–18
Breadth-first search supplies the converse constructively. Start an uncoloured vertex with colour , and use a FIFO queue to explore its graph component. When an edge first discovers , give the opposite colour to , record as its parent in a rooted tree, and enqueue . If both endpoints of any scanned edge already have the same colour, stop with a conflict. Restart from an uncoloured vertex until every graph component has been examined. If no conflict occurs, all edges cross the two colour classes, which are the required independent sets.[ref]
A conflict also explains the failure. In the rooted tree produced by breadth-first search, let be the graph distance from . The colour of is its distance's integer parity. An edge in an undirected graph satisfies , so equal colours force . Follow the two parent chains upward to their lowest common ancestor , discard the shared graph path from to , and join the remaining two graph paths with the conflict edge . The result is a genuine graph cycle withedges, an odd integer. The two branches have no shared vertices except , so this is more than a closed walk. This odd cycle is a certificate that anyone can check directly, using only its listed vertices and edges.
In the example, breadth-first search from gives , , and . The conflict edge closes the odd cycle , with five edges. The common edge is excluded. Thus the same procedure returns either two independent sets covering , or an explicit odd cycle. With adjacency lists and constant-time FIFO queue operations, its time complexity is in Big O notation, with additional storage.[ref]
The two parts often have a practical meaning: workers and jobs, with an edge exactly when a worker can perform a job. A matching in a graph chooses compatible worker–job pairs with no reused endpoint; merely being bipartite does not guarantee enough compatible pairs. Hall's marriage theorem characterizes when every worker can be matched, and the assignment problem adds costs to seek an optimal assignment. These connections make the bipartite structure useful after recognition, as the starting point for selecting edges under constraints.
Hall allocation model 2026-10-14
In a unit-capacity assignment problem, left vertices represent demands and right vertices represent individually usable resources; an edge records compatibility. All constraints must be encoded by those allowed pairs and by using each resource at most once. Hall's marriage theorem decides feasibility. Costs belong to an additional mathematical optimization problem; precedence between jobs or requirements for consecutive slots need additional modelling.
The authored Notes on the design of a conference scheduler by David R. MacIver (Implementation, 7 August 2022) illustrates a Hall obstruction with four talks confined to three slots. With one talk per slot, that subset has size four and a graph neighbourhood of size three. An unused slot outside its graph neighbourhood does not remove the bottleneck. In the three-job example above, the same scheduling model instead has two complete assignments.
The allocation exercise in Graph Theory by Reinhard Diestel (Matching, Covering and Packing, printed p. 20, Exercise 9) asks for disjoint subsets of prescribed nonnegative integer sizes . Replace demand by left vertices with allowed resource set . Hall's marriage theorem gives exactly the conditionFor a numerical instance, let , , and . The separate demands and their combined demand fit, and works. Raising to two leaves both individual tests valid but demands four distinct resources from a set union of size three. This is the same collective obstruction with repeated demand vertices.
Hall's marriage theorem Created 2026-10-14 Updated 2026-10-14
For a finite bipartite graph with disjoint left and right vertex sets, Hall's marriage theorem characterizes when distinct allowed partners can be chosen for every left vertex. A matching in a graph with matching saturation of exists if and only if every subset satisfiesThe graph neighbourhood counts distinct right vertices, rather than edges or repeated choices. This is the Hall condition. Its failure supplies a concrete Hall obstruction. Necessity follows because the chosen partners of are distinct members of ; sufficiency is the surprising assertion that these collective counts rule out every obstacle.[ref]
The right side may be larger: matching saturation of leaves right vertices unmatched. Only when does a matching in a graph saturating automatically become a perfect matching. For a specified subset , apply the same criterion only to , using the induced subgraph on . The remaining left vertices need not be matched. The empty set gives ; if is empty, the empty matching in a graph suffices.
Consider a scheduling model with three unit-duration jobs and four available slots on one machine. Each job needs exactly one slot, each slot accepts at most one job, and the allowed slots areThe bipartite graph below admits , a matching in a graph saturating all jobs while leaving slot unused. It is not a perfect matching of the seven-vertex graph. A greedy choice initially blocks , but the augmenting path in a matching replaces by ; subsequent assignment of succeeds. A bad partial choice is not an impossibility certificate.
There are eight subsets of . Listing each graph neighbourhood makes the all-subset requirement explicit:
There are exactly two matchings in a graph saturating : and . Job forces slot , then job forces slot , leaving two choices for .
A finite bipartite graph of positive maximum degree has a matching in a graph covering every vertex of vertex degree . To cover the vertices of maximum degree in one side , apply Hall's marriage theorem to that subset: for each subset of it, double counting gives , where is its graph neighbourhood. Construct the corresponding matching in a graph for the other side, then use the union of two matchings to cover both specified subsets simultaneously.
Two minimal left covering nets for the same identity neighbourhood can be matched bijectively so that paired translates intersect. Join to when . For , its neighbours cover every point covered by , so still covers the group. Minimality forces . Hall's marriage theorem supplies the matching, and an intersection gives . Averaging a continuous function over matched nets therefore gives values differing by at most its uniform oscillation on right displacements in . This is the finite combinatorial step in constructing Haar measure on a compact group.
Matching saturation 2026-10-14
A matching in a graph saturates a specified vertex set when every vertex of is incident to one selected edge. Exactly one selected edge meets each such vertex, since matching edges have disjoint endpoints. Vertices outside may remain unmatched. A perfect matching saturates the entire vertex set; Hall's marriage theorem tests matching saturation of a specified side in a finite bipartite graph.
Past exam of the computer science course of the University of Oxford 2018 Algorithms 3 d Solution 2026-10-31
Regard the two kinds of agents as the two sides of a complete bipartite graph, with edge weight . Pairing everyone is a perfect matching, and its maximum total weight is . Consider the capacitated linear programIt is feasible and bounded. Every optimum has all row and column sums equal to one: otherwise the equal total deficits of the two sides give a row and column both below one. Increasing by the smaller of their positive deficits remains feasible and increases the objective because , a contradiction.
Thus an optimum is a doubly stochastic matrix. By the Birkhoff-von Neumann theorem it is a convex combination of permutation matrices, so at least one corresponding perfect matching has weight at least its objective. Conversely every such perfect matching gives a feasible matrix. Hence . One way to justify the decomposition is to apply Hall's marriage theorem to the positive-entry support, subtract the smallest entry on a supported perfect matching, and repeat after rescaling the nonzero remainder; each subtraction removes a positive entry, so the process terminates.
The dual linear program assigns nonnegative dual variables to the row and column capacity constraints:These are exactly the permitted payments and all the pairwise acceptance conditions, so its optimal value is . It is feasible, for example by taking and . Strong duality now gives . In particular, the nonnegative payment restriction has been retained throughout; using capacity inequalities rather than equality constraints avoids introducing unrestricted prices.
For a direct weak duality check, sum over any pairing . Its revenue never exceeds the company's total offered payment. The linear programming duality and integrality argument prove that this lower bound on payments is attained.
Hall's marriage theorem says that a finite bipartite graph with parts has a matching covering if and only if for every . Necessity follows because matching edges send the vertices of to distinct neighbours.
For sufficiency, choose a maximum matching . If it misses , explore all alternating paths from , taking unmatched edges from left to right and matched edges from right to left. Let and be the reached vertices. No vertex of can be unmatched, since flipping the edges along the resulting augmenting path would enlarge .
Every neighbour of a reached left vertex is reached on the right: unmatched edges are exploration steps, and a matched edge leads back to an already reached matching partner. Thus . Each right vertex in is matched to a reached left vertex other than , and every reached left vertex other than arose this way. These matching partners give a bijection . Hence , contradicting the assumed inequality. Therefore the maximum matching covers .
Write the bipartition as . Counting edges by their left and right ends gives , so the parts have equal size. Put . If some violated Hall's marriage theorem in , let , so .
There are edges of incident with , of which at most can end in . Thus at least end in . All those edges must have been deleted, by the definition of . This contradicts . Hence has a matching covering , and equal part sizes make it a perfect matching avoiding every edge of .
Hall's marriage theorem states that a finite bipartite graph with vertex classes has a matching covering if and only ifNecessity follows because the matched neighbors of the vertices in are distinct members of .
For sufficiency, induct on . The empty case is immediate. First suppose there is a nonempty proper subset with . The induced graph between and satisfies Hall's condition, so induction matches . In the remaining graph between and , every satisfiesInduction matches the rest, and the two matchings are disjoint.
Otherwise every nonempty proper has . Choose any edge , which exists by Hall's condition if is nonempty. Delete and . Every nonempty subset of loses at most one neighbor and therefore still satisfies Hall's condition. Induction provides a matching of this smaller graph; append . If , choosing its neighbor already completes the argument. This proves the theorem.
Verify Hall's marriage theorem. Let ; the empty case is immediate. If , any has at least neighbors in , so .
Next suppose . If , then has . There are no edges between and , so . But the regularity assumption impliesa contradiction.
Finally, if , then . Every has at least neighbors in , so at least one of them lies in . Thus and .
All possible sizes of are covered, even if the middle range is empty. Hall's condition holds, so there is a perfect matching between and . This is the perfect matching criterion for a regular pair with minimum degree.
Hall's marriage theorem says that a bipartite graph with parts has a matching saturating if and only ifNecessity follows because the matched neighbours of vertices of are distinct and belong to .
For sufficiency, assume these inequalities. Let be any vertex cover, with and . Every neighbour of must belong to , since otherwise its edge from is uncovered. Therefore , and . The whole part is itself a vertex cover of size . Part (ii) now gives a matching of size exactly , so it saturates .
Hall's marriage theorem says that a bipartite graph with parts has a matching saturating if and only ifNecessity follows because the matched neighbours of vertices of are distinct and belong to .
For sufficiency, assume these inequalities. Let be any vertex cover, with and . Every neighbour of must belong to , since otherwise its edge from is uncovered. Therefore , and . The whole part is itself a vertex cover of size . Part (ii) now gives a matching of size exactly , so it saturates .
A proper edge colouring assigns colours to the edges of a graph so that distinct edges sharing a vertex have different colours. The edge chromatic number is the least number of colours in such an assignment. Equivalently, it is the least number of matchings in a graph whose disjoint union is the entire collection of edges.
Vizing's theorem states that a finite simple graph of maximum degree satisfiesThe lower bound holds because all edges incident with a vertex of vertex degree require different colours.
Hall's marriage theorem states that a finite bipartite graph with vertex sets has a matching in a graph saturating if and only ifwhere is the graph neighbourhood of . Here matching saturation means that each vertex of is incident with an edge of the matching in a graph; it does not require every vertex of to be met.
Let . Apply Hall's marriage theorem to the induced subgraph on , which is a bipartite graph. For any subset , double counting the edges from to its graph neighbourhood givesThe equality uses the fact that every neighbour of lies in , so all edges incident with have been counted. The final inequality uses the maximum degree bound on . Since , division gives the Hall condition .
Consequently there is a matching in a graph saturating . If is empty, use the empty matching in a graph. This proves the required matching covering maximum-degree vertices in a bipartite graph on the specified side; other vertices need not be met.
We verify the Hall condition for . Let . If is empty, then . Suppose . Choose . Its graph neighbourhood is contained in , so the minimum degree hypothesis givesIf , suppose for a contradiction that some vertex exists. All neighbours of lie in , socontradicting the minimum degree hypothesis. Thus and .
Every subset satisfies the Hall condition. By Hall's marriage theorem, there is a matching in a graph saturating . Since , its edges also cover every vertex of . It is therefore a complete matching, meaning a perfect matching. For , the empty matching in a graph already has this property.
Past exam of the mathematics course of the University of Cambridge 2002 iii Paper 11 3 i Solution Created 2026-10-03 Updated 2026-10-14
Choose a fixed prime , and put . We first derive the polynomial step: a graph on vertices and edges, with maximum degree at most , contains a nonempty -regular subgraph. Use a Boolean variable for each edge and work over . DefineThe first product has degree at most , while the full squarefree monomial has coefficient in the second term with its minus sign. The Combinatorial Nullstellensatz, with every grid , gives a nonzero value of . Since , this is a nonempty edge selection. The second product is then zero, so the first is nonzero. Fermat's little theorem makes each selected vertex degree zero modulo . The maximum-degree bound implies that every positive selected degree is precisely . This proves the prime-regular subgraph from Boolean polynomial constraints.
We next turn density into an almost-regular bipartite subgraph, keeping the logarithmic loss explicit. Let the original graph have vertices and edges. Some bipartition retains at least edges: choose the sides independently with probability and average the number crossing. Its average degree is at least . Repeatedly delete a vertex of degree at most half the current average degree. Such a deletion cannot lower that average, sinceThe process cannot delete the last positive-density graph, because the maintained average is positive. At termination the minimum degree is an integer .
Choose the larger side of this remaining bipartite graph, with opposite side . Keep exactly edges at each vertex of ; choices at different vertices of do not conflict. Remove any now-isolated vertices of . Thus , and every vertex of has degree .
Such a half-regular graph contains a half-regular restriction with a perfect matching. Choose a minimal nonempty satisfying , which exists because the whole side satisfies this inequality. In fact equality holds: if it were strict, deleting a vertex of would retain the inequality, contradicting minimality; the singleton case has at least one neighbor. Every proper subset satisfies . Hall's marriage theorem therefore supplies a perfect matching on . All edges incident with each vertex of remain inside that restriction.
Delete this perfect matching and repeat the restriction argument. The left degrees decrease by one at each step. We obtain edge-disjoint perfect matchings on nested nonempty vertex sets, with sizesFor any with , the union of consecutive matchings in a graph has maximum degree at most and at least edges on vertices. Ifit has more than edges, so the polynomial step yields a -regular bipartite subgraph. Every regular bipartite graph decomposes into perfect matchings: for a set in one part, counting incident edges gives Hall's inequality, so a perfect matching exists; remove it and repeat. Choosing of these matchings in a graph gives a nonempty -regular subgraph. This is the nested matching criterion for a regular subgraph.
If no -regular subgraph exists, every displayed size ratio must therefore satisfy the reverse inequality. Iterating at indices gives, with ,Consequently andCombining with proves the required edge bound. For example the finite constantworks for every , and the case has no edges. ThusThe logarithm comes from how often a nested matching in a graph vertex set can shrink by a fixed factor before becoming empty; it is not supplied by the polynomial step alone.
Past exam of the mathematics course of the University of Cambridge 2005 ii Paper 3 17F Solution Created 2026-09-24 Updated 2026-10-14
For fixed -element subsets , their rectangle is empty with probability . A union bound over at most choices gives . For a specified vertex and a specified -subset, the chance of no edges is . There are at most choices on each side, givingFor , and . Hence . The logarithm of this bound is , which tends to because . Thus the bad-event probability tends to zero.
The printed phrase “almost surely” must mean asymptotically almost surely as . At any fixed , the empty graph has positive probability , so the literal probability-one assertion is false.
When no bad event occurs, verify Hall's marriage theorem. If , each vertex has more than neighbors because event is absent, so . If , a failure would leave at least vertices outside , producing a forbidden empty -square. If , every vertex in meets because event is absent; hence . The empty set also satisfies Hall. Therefore the graph has a perfect matching whenever the three events are absent, proving the random bipartite matching from empty-rectangle exclusion result with probability tending to one.
Past exam of the mathematics course of the University of Cambridge 2009 ii Paper 1 17F ii Solution Created 2026-09-24 Updated 2026-10-14
Let be the two parts of the bipartite graph. Counting edges gives , hence . For , the edges incident to all end in , whose vertices have total capacity . Thus . Hall's marriage theorem gives a perfect matching, and no matching in a graph can have more than edges. The matching number is .
Past exam of the mathematics course of the University of Cambridge 2009 ii Paper 1 17F i Solution Created 2026-09-24 Updated 2026-10-14
Hall's marriage theorem states that a finite bipartite graph with parts has a matching in a graph saturating exactly when for every . Necessity follows because the matched neighbours of are distinct.
For sufficiency use induction on . The empty case is immediate. If a nonempty proper subset has , the induced graph on satisfies Hall's condition and has a saturating matching in a graph by induction. The remaining graph on also satisfies it: for ,Apply induction again and unite the two matchings in a graph. If there is no such tight proper subset, every nonempty proper has . Choose a vertex and a neighbour , which exists by Hall's condition. Delete both. Every remaining subset loses at most one neighbour and still satisfies Hall's condition. Induction supplies a matching in a graph of the remainder; add . For this last step directly proves the assertion.


