3.5.17 · D1Graphs

Foundations — Bipartite graphs — 2-coloring test, bipartite matching — Hopcroft-Karp

1,999 words9 min readBack to topic

This page assumes you know nothing. Before you touch the parent note (topic), we build every symbol it fires at you, one at a time, each anchored to a picture.


0. The very first picture: dots and lines

Everything in this topic is drawn from two ingredients: dots and lines connecting dots.

Figure — Bipartite graphs — 2-coloring test, bipartite matching — Hopcroft-Karp

WHY we need both. The topic is entirely about relationships between things. A vertex holds a thing; an edge records a relationship. No other objects exist here — literally everything else is built from dots and lines.


1. The container: what means

The parent note opens with . Let's earn every letter.

Two size symbols you'll see constantly:


2. Neighbors and "walking" the graph

Figure — Bipartite graphs — 2-coloring test, bipartite matching — Hopcroft-Karp

WHY it matters: the 2-coloring algorithm must restart on every island (one of the parent note's "common mistakes"). If you forget an island, you never color it.


3. Two teams: the bipartite structure itself

Now we can state the star concept precisely.

Figure — Bipartite graphs — 2-coloring test, bipartite matching — Hopcroft-Karp

4. Colors: the same idea, re-dressed

The parent's propagation rule just says: "give a neighbor the opposite color." With only two colors , the opposite of is and of is — and , . That tiny arithmetic is the flip.


5. Matching vocabulary (for Parts 3–4 of the parent)

Figure — Bipartite graphs — 2-coloring test, bipartite matching — Hopcroft-Karp

6. Tools you'll lean on

  • "big-O": a rough upper bound on running time. means "work grows in step with the number of dots plus lines" — no wasted rescanning.
  • BFSBFS — explores a graph in expanding rings (nearest dots first). The 2-coloring test and Hopcroft–Karp's layering both use it.
  • DFSDFS — dives deep along one trail before backtracking. Used to extract augmenting paths.
  • Flow viewMaximum Flow — bipartite matching is a special max-flow problem; useful for proofs.
  • Beyond two teamsBlossom Algorithm handles matching in general (non-bipartite) graphs, where odd cycles ("blossoms") appear. König's TheoremKönigs Theorem — ties max matching to min vertex cover in bipartite graphs.

Prerequisite map

Vertex a dot

Edge a line

Graph G equals V and E

Neighbors and walking

Path and cycle length

Odd vs even cycle

Connected components

Bipartite two teams L and R

2-coloring test

Matching M

Augmenting paths

Hopcroft-Karp fast matching

BFS and DFS


Equipment checklist

Reveal each line only after you can answer it in your own words.

What is a vertex and what does it represent?
A single dot standing for one thing (person, job, pixel).
What is an edge, and how is it written?
A line connecting two vertices, written as the pair .
What do , , and mean?
= set of all dots, = set of all lines, = the whole graph bundling both.
What do and count?
The number of vertices and the number of edges respectively.
What are the neighbors of a vertex ?
Every dot reachable from by sliding along exactly one edge.
What is the length of a cycle?
The number of edges (segments) in the closed loop.
Why does odd vs even cycle length matter?
Even loops can be split into two teams; odd loops cannot, so an odd cycle means not bipartite.
What does it mean for a graph to be disconnected?
It breaks into separate islands (components) with no edges between them.
What do and say together?
Every dot is in exactly one of the two teams — none missed, none in both.
State the bipartite condition in one sentence.
Every edge has one endpoint in and the other in ; no edge stays inside a team.
Why is "bipartite" the same as "2-colorable"?
Choosing team Left/Right is the same as painting color 0/1 so no edge joins same-colored dots.
What is a matching ?
A set of chosen edges where no two share a vertex — each thing paired with at most one partner.
What is a free (unmatched) vertex?
A vertex that no matching edge touches.
What does mean intuitively?
Work grows in proportion to dots plus lines — each touched about once, no rescanning.