Tutorials › Graph Theory (Undergraduate) › Bipartite Graphs and Explicit Bipartitions

Bipartite Graphs and Konig's Theorem · Tutorial 257 of 799

Bipartite Graphs and Explicit Bipartitions

Learn to describe and verify bipartite graphs by checking that every edge joins two disjoint vertex classes.

Intermediate 10 min read

What You'll Learn

  • State a bipartition using two disjoint classes whose union is the entire vertex set.
  • Check a proposed bipartition directly from an edge list.
  • Handle isolated vertices and disconnected graphs when choosing the classes.
  • Translate between bipartitions and proper two-colorings.
  • Use the sizes of the classes to bound the number of edges.
  • Identify and explain a failed bipartition by tracing edge constraints.

Describing a Bipartition

A bipartite graph is described by separating its vertices into two classes and checking that every edge goes between the classes. This is a concrete way to verify bipartiteness from a vertex and edge list: the proposed classes must account for every vertex, and no listed edge may have both endpoints in the same class. The graph is finite and simple throughout, so edges join distinct vertices and there are no multiple edges.

Definition: A bipartition of a graph \(G=(V,E)\) is a pair of sets \(X,Y\) such that \(X\cap Y=\varnothing\), \(X\cup Y=V\), and every edge has one endpoint in \(X\) and one endpoint in \(Y\). A graph is bipartite if it has at least one bipartition. Either class may be empty.

The conditions on \(X\) and \(Y\) do different jobs. Their union must include every vertex, including isolated vertices; their intersection must be empty, so that each vertex belongs to exactly one class. The edge condition is then checked for every edge \(uv\in E\): either \(u\in X,v\in Y\), or \(u\in Y,v\in X\). In particular, an edge with both endpoints in \(X\), or both in \(Y\), invalidates the proposed bipartition.

For a graph given by lists, a reliable verification has three steps: first check that the classes are disjoint; next check that together they contain exactly \(V\); finally inspect every edge and confirm that its endpoints lie in opposite classes. Checking only a sample of the edges is not enough to verify a bipartition.

Bipartitions and Two-Colorings

A two-coloring assigns one of two colors to each vertex. It is called proper when adjacent vertices receive different colors. The two colors can be represented by the classes \(X\) and \(Y\), so this viewpoint gives an equivalent description.

Theorem: A graph is bipartite if and only if its vertices can be properly colored with two colors.

Proof. Suppose first that \(X,Y\) is a bipartition. Give every vertex in \(X\) the first color and every vertex in \(Y\) the second color. By the definition of bipartition, each edge has one endpoint in each class, so its endpoints have different colors. This is a proper two-coloring.

Conversely, suppose every vertex has been assigned one of two colors and every edge joins vertices of different colors. Let \(X\) be the set of vertices with the first color and \(Y\) the set with the second color. Each vertex received exactly one color, so \(X\cap Y=\varnothing\) and \(X\cup Y=V\). The coloring condition says every edge joins different colors, hence one endpoint is in \(X\) and the other is in \(Y\). Thus \(X,Y\) is a bipartition. The argument also covers an edgeless graph: every coloring is proper when there are no edges. \(\square\)

This equivalence is useful as a way to think about a proposed split, but explicit classes make verification especially direct. When starting from an edge list, write down the two classes and check each listed edge against them.

Worked Example: Listing the Two Classes

Let \(G=(V,E)\), where \(V=\{a,b,c,d,e,f,g\}\) and \(E=\{ab,ac,bd,ce,df,eg\}\). Verify that \(X=\{a,d,e\}\) and \(Y=\{b,c,f,g\}\) form a bipartition.

First, the two sets have no common vertex. Their union is \(\{a,b,c,d,e,f,g\}=V\), so every vertex appears exactly once. Now check the edges individually:

  • \(ab\): \(a\in X\) and \(b\in Y\).
  • \(ac\): \(a\in X\) and \(c\in Y\).
  • \(bd\): \(b\in Y\) and \(d\in X\).
  • \(ce\): \(c\in Y\) and \(e\in X\).
  • \(df\): \(d\in X\) and \(f\in Y\).
  • \(eg\): \(e\in X\) and \(g\in Y\).

Every edge crosses between the classes, so \(X,Y\) is a bipartition and \(G\) is bipartite. As a final check, the edge list has six edges and all six passed the test; no edge was omitted from the verification.

Isolated Vertices and Disconnected Graphs

An isolated vertex has degree zero, meaning that no edge is incident with it. Since the bipartition condition applies to edges, an isolated vertex imposes no restriction on which class it occupies. It must still be placed in one of the two classes, because \(X\cup Y\) must equal \(V\).

Likewise, if a graph has several connected components, the edge check still applies to the entire edge list. There are no edges between different components, so the choice of classes in one component does not directly constrain the choice in another. For an explicit bipartition, it is enough to give classes covering the whole graph and verify all its edges; no connectedness assumption is needed.

Worked Example: An Isolated Vertex

Let \(G=(V,E)\), where \(V=\{1,2,3,4,5,6,7\}\) and \(E=\{12,14,23,34,35,46,56\}\). Verify the proposed classes \(X=\{1,3,6\}\) and \(Y=\{2,4,5,7\}\).

The classes are disjoint and their union is all seven vertices. Check the edges: \(12\) joins \(X\) to \(Y\); \(14\) joins \(X\) to \(Y\); \(23\) joins \(Y\) to \(X\); \(34\) joins \(X\) to \(Y\); \(35\) joins \(X\) to \(Y\); \(46\) joins \(Y\) to \(X\); and \(56\) joins \(Y\) to \(X\). Thus every edge crosses the classes, so they form a bipartition.

Vertex \(7\) is isolated: it does not occur in any edge. It still belongs to \(Y\), ensuring that the classes cover \(V\). It could instead be moved to \(X\), and the edge check would remain unchanged because no edge is incident with \(7\). This confirms both that \(7\) is isolated and that the displayed classes cover the graph.

How Many Edges Can Join Two Classes?

Once a bipartition is specified, each possible edge must use one vertex from each class. There are \(|X||Y|\) such cross-class pairs: for each of the \(|X|\) choices in \(X\), there are \(|Y|\) choices in \(Y\). This gives an edge bound, with an exact description of when equality occurs.

Theorem: If \(X,Y\) is a bipartition of a finite simple graph \(G\), then \(|E|\leq |X||Y|\). Equality holds if and only if every pair with one endpoint in \(X\) and one in \(Y\) is an edge; in that case \(G\) is the complete bipartite graph on those classes.

Proof. Because the graph is simple, there is at most one edge for each unordered pair of distinct vertices. The bipartition condition says every edge is a pair with one endpoint in \(X\) and the other in \(Y\). There are exactly \(|X||Y|\) such pairs, so the number of edges cannot exceed \(|X||Y|\). If equality holds, all these possible pairs must be edges: having even one missing pair would leave fewer than \(|X||Y|\) edges. Conversely, if every cross-class pair is an edge, there is one edge for each of the \(|X||Y|\) pairs, giving equality. If either class is empty, there are no cross-class pairs and the edge condition forces \(E=\varnothing\); the inequality and equality characterization still hold. \(\square\)

Worked Example: The Complete Bipartite Graph \(K_{2,3}\)

Let \(V=\{u,v,a,b,c\}\), with classes \(X=\{u,v\}\) and \(Y=\{a,b,c\}\). Take \(E=\{ua,ub,uc,va,vb,vc\}\). Each edge joins the two classes, so this is a bipartite graph.

There are \(|X||Y|=2\cdot3=6\) possible cross-class pairs. Listing them by their endpoint in \(X\), the pairs are \(ua,ub,uc\) from \(u\) and \(va,vb,vc\) from \(v\). All six occur in \(E\), so \(|E|=6=|X||Y|\). The equality condition is met: the graph contains every possible edge between the classes. It is therefore the complete bipartite graph \(K_{2,3}\).

Check: The displayed edge list has exactly six distinct edges, and the independent count of cross-class pairs is \(2\cdot3=6\). Thus the list neither omits a possible cross-class edge nor includes an edge within a class.

When a Proposed Split Fails

A candidate pair of classes can fail in two different ways: it may not be a partition of the vertices, or it may be a partition but have an edge inside one class. Separating these checks helps diagnose mistakes. In particular, a failed edge check cannot be repaired by ignoring that edge; the proposed classes must be changed, or the graph is not bipartite.

Worked Example: Edge Constraints That Cannot Be Satisfied

Let \(G=(V,E)\), where \(V=\{p,q,r,s,t\}\) and \(E=\{pq,qr,rp,rs,st\}\). Suppose a bipartition existed. Since \(pq\) is an edge, \(p\) and \(q\) would have to belong to opposite classes. Since \(qr\) is an edge, \(r\) would have to be in the same class as \(p\). But \(rp\) is also an edge, so \(r\) and \(p\) would have to lie in opposite classes. These requirements contradict each other. Therefore no bipartition exists.

For a concrete check, name the class containing \(p\) as \(X\). Then \(q\) must be in \(Y\), and the edge \(qr\) forces \(r\) into \(X\). The edge \(rp\) now has both endpoints in \(X\), violating the definition. Choosing \(p\in Y\) instead only swaps the names \(X\) and \(Y\), so it cannot remove the contradiction. The remaining edges \(rs\) and \(st\) cannot fix the failure already forced by \(pq,qr,rp\).

Common Pitfalls

Leaving out an isolated vertex. If a vertex does not occur in the edge list, it is easy to forget it when writing the classes. But the classes must partition \(V\), not just the vertices incident with edges. Put each isolated vertex in either class.

Checking only whether the classes are disjoint. Disjoint classes may still fail to cover the vertex set. For example, if \(V=\{1,2,3\}\), then \(\{1\}\) and \(\{2\}\) are disjoint but omit vertex \(3\). Check both disjointness and union before checking edges.

Checking only some edges. A single edge within one class disproves the proposed bipartition, even if every other edge crosses. For instance, the wrong calculation “\(pq\) and \(qr\) cross, so the triangle \(pqr\) is bipartite” overlooks \(rp\): after \(p\in X\), \(q\in Y\), and \(r\in X\), edge \(rp\) has both endpoints in \(X\). The correction is to check every listed edge, not merely two of them.

Assuming the classes must have equal size. The definition imposes no such condition. In \(K_{2,3}\), the two classes have sizes two and three, yet every edge joins opposite classes. The relevant requirement is about endpoints of edges, not the sizes of the classes.

Check Your Understanding

For each question, use the vertex and edge lists as written and state the checks that justify your answer.

  1. Let \(V=\{a,b,c,d\}\), \(E=\{ab,bc,cd\}\). Do \(X=\{a,c\}\), \(Y=\{b,d\}\) form a bipartition?
  2. Let \(V=\{1,2,3,4\}\), \(E=\{12,23,34,41,13\}\). Does \(X=\{1,3\}\), \(Y=\{2,4\}\) form a bipartition? Identify any edge that decides the check.
  3. Why must an isolated vertex be placed in one of the two classes even though it creates no edge constraint?
  4. A bipartition has classes of sizes \(3\) and \(4\). What is the largest possible number of edges, and what condition gives that number?
  5. Explain why a proper two-coloring of the vertices gives disjoint classes whose union is the entire vertex set.