Tutorials › Graph Theory (Undergraduate) › Bipartitions and Two-Colorings

Subgraphs, Isomorphism and Special Families · Tutorial 33 of 799

Bipartitions and Two-Colorings

Translate between vertex partitions and red-blue assignments, then verify whether each proposed assignment is proper by checking every edge.

Beginner 9 min read

What You'll Learn

  • Define a bipartition and a proper coloring from a two-color palette.
  • Convert a partition of the vertices into a red-blue assignment and back.
  • Verify a candidate coloring by checking each edge individually.
  • Recognize why an isolated vertex may receive either color.
  • Identify a graph that cannot be properly colored with two colors.

Partitions and Color Assignments

A two-coloring is a way to encode a division of the vertices into two groups. It is useful when the groups represent two roles, types or states, with the requirement that adjacent vertices have different roles. The key is not that every possible edge between the groups must be present, but that no edge may have both endpoints in the same group.

Throughout, graphs are finite and simple. A coloring with palette \(\{\text{red},\text{blue}\}\) assigns one of these two colors to every vertex; it is proper if the endpoints of every edge receive different colors. Thus a proper coloring may use just one color when there are no edges. A bipartition of \(V(G)\) is a pair of disjoint sets \(X,Y\) whose union is \(V(G)\); either part is allowed to be empty.

Definition: A graph \(G=(V,E)\) is bipartite if there is a bipartition \((X,Y)\) of \(V\) such that every edge has one endpoint in \(X\) and the other in \(Y\). The sets \(X\) and \(Y\) are called the parts. A proper two-coloring is an assignment from \(V\) to \(\{\text{red},\text{blue}\}\) for which every edge has differently colored endpoints.

The same condition can be checked in either language. In the partition language, inspect every edge and verify that it crosses from \(X\) to \(Y\). In the coloring language, inspect every edge and verify that its endpoint colors differ. In particular, vertices that are not joined by an edge are allowed to have the same color.

A bipartite graph need not be complete bipartite. For a bipartition \((X,Y)\), a complete bipartite graph has every possible edge between \(X\) and \(Y\); a general bipartite graph only requires that all its existing edges cross between the parts. The earlier material on complete bipartite graphs treats that more restrictive family.

The Correspondence

Theorem: A graph is bipartite if and only if it has a proper coloring from the palette \(\{\text{red},\text{blue}\}\).

Proof. First suppose \(G\) is bipartite with parts \(X,Y\). Color every vertex of \(X\) red and every vertex of \(Y\) blue. By the definition of bipartition, each edge has one endpoint in \(X\) and one in \(Y\). Its endpoints therefore receive different colors, so the coloring is proper.

Conversely, suppose \(G\) has a proper coloring from the stated palette. Let \(X\) be the set of red vertices and \(Y\) the set of blue vertices. Each vertex receives exactly one color, so \(X\cap Y=\varnothing\) and \(X\cup Y=V\). Since the coloring is proper, no edge has both endpoints red or both endpoints blue. Every edge therefore has one endpoint in \(X\) and the other in \(Y\), so \((X,Y)\) is a bipartition. This also covers the graph with no vertices: both parts are empty, and the unique coloring of the empty vertex set is proper because there are no edges to check. \(\square\)

The theorem is a correspondence, not a requirement to find a special pattern of edges: once the vertex groups are chosen, the test is simply whether every edge crosses between them. Conversely, a proper red-blue assignment itself specifies the two groups. Exchanging red and blue exchanges \(X\) and \(Y\), without changing whether the coloring is proper.

Proposition: If a graph has at least one edge, then every proper coloring from a two-color palette uses both colors. If it has no edges, assigning the same color to every vertex is proper.

Proof. Let \(uv\) be an edge. In a proper coloring, \(u\) and \(v\) must receive different colors, so both red and blue occur. If the graph has no edges, there is no edge whose endpoints could violate the properness condition. Hence assigning red to every vertex is proper (and the same argument works for blue). \(\square\)

Checking a Candidate Coloring

To verify a proposed coloring, write down the vertex sets and the full edge set first. Then list each edge and compare the colors of its two endpoints. A single edge with matching endpoint colors disproves properness; to verify properness, every edge in the edge set must pass. Checking only a selection of edges is not enough.

Worked Example: Correcting a Failed Coloring

Let \(G=(V,E)\), where \(V=\{1,2,3,4\}\) and \(E=\{12,13,24,34\}\). Test the proposed coloring with red vertices \(\{1,2\}\) and blue vertices \(\{3,4\}\), then find a proper coloring if possible.

Check the four edges in the stated edge set. Edge \(12\) has both endpoints red, so it fails. Edge \(13\) has endpoint colors red and blue, so it passes. Edge \(24\) has endpoint colors red and blue, so it passes. Edge \(34\) has both endpoints blue, so it fails. The proposed coloring is not proper.

The all-red assignment is not a proper coloring: edges \(12\) and \(13\) would both have red endpoints. Instead, assign red to \(\{1,4\}\) and blue to \(\{2,3\}\). Now check every edge: \(12\) is red-blue; \(13\) is red-blue; \(24\) is blue-red; and \(34\) is blue-red. All four edges cross between the parts, so this assignment is proper, and the graph is bipartite.

Check: The proposed parts \(\{1,4\}\) and \(\{2,3\}\) are disjoint and their union is \(\{1,2,3,4\}\). Each listed edge has one endpoint in each part, confirming the result using the partition definition.

Worked Example: An Isolated Vertex

Let \(G=(V,E)\), where \(V=\{a,b,c,d,e\}\) and \(E=\{ab,bc,cd\}\). Vertex \(e\) is isolated, meaning no edge in \(E\) has \(e\) as an endpoint. Test the coloring with red vertices \(\{a,c,e\}\) and blue vertices \(\{b,d\}\).

Check each edge. Edge \(ab\) has colors red and blue. Edge \(bc\) has colors blue and red. Edge \(cd\) has colors red and blue. These are all the edges, and each has differently colored endpoints, so the coloring is proper. Equivalently, the two parts \(\{a,c,e\}\) and \(\{b,d\}\) form a bipartition.

The color of \(e\) does not affect any edge check: there is no edge incident with \(e\). For example, moving \(e\) to the blue part also gives a proper coloring. In that case the parts are \(\{a,c\}\) and \(\{b,d,e\}\), and the same three edges still cross between them.

Check: The full edge set remains \(ab,bc,cd\), and those three edges have endpoint colors red-blue, blue-red and red-blue in the second assignment as well. The isolated vertex is included in a part even though it contributes no edge to check.

Worked Example: A Triangle Cannot Be Two-Colored Properly

Let \(G=(V,E)\), where \(V=\{x,y,z\}\) and \(E=\{xy,yz,zx\}\). Consider the candidate coloring that gives \(x\) red and \(y,z\) blue.

Check the edges: \(xy\) has colors red and blue, so it passes; \(yz\) has blue at both endpoints, so it fails; and \(zx\) has colors blue and red, so it passes. The candidate is not proper. In fact, no proper two-coloring exists. If \(x\) is red, both \(y\) and \(z\) must be blue because each is adjacent to \(x\), and then edge \(yz\) has equal-colored endpoints. If \(x\) is blue, the same argument with the colors reversed forces \(y,z\) to be red, again making \(yz\) fail. These are the only possibilities for the color of \(x\).

Check: The obstruction uses all three listed edges: \(xy\) and \(xz\) force \(y,z\) to have the color opposite \(x\), while \(yz\) requires them to have different colors. Those requirements cannot all hold together.

What the Edge Test Does—and Does Not—Say

For a proposed assignment on a specified graph, checking every edge is a complete test: if every edge has differently colored endpoints, the coloring is proper by definition; if an edge fails, it is not proper. This is a verification procedure for a candidate, not necessarily a method for finding one. When no candidate has been supplied, choosing colors that satisfy all edge constraints may require additional reasoning.

Keep the direction of the check straight. To show that a coloring is proper, account for every edge. To show that a particular coloring is not proper, one failing edge is enough. To show that a graph has no proper two-coloring, however, one failed candidate does not suffice: another assignment might work. The triangle example handles that stronger claim by considering both possible colors for one vertex and showing that each forces a contradiction.

Also distinguish the two parts from the edges. The parts partition the entire vertex set, including isolated vertices. Edges do not have to include every possible pair across the parts, and vertices in the same part need not all be adjacent. The defining restriction is only that no edge lies within a part.

Why the Correspondence Is Useful

The partition description is often convenient when a graph comes with two natural types of vertices. The coloring description is convenient for checking a proposed assignment: it turns the condition into a local test on each edge. The theorem lets us switch between these descriptions without changing the underlying requirement.

For example, if vertices represent tasks and an edge means that two tasks conflict, a proper red-blue coloring assigns tasks to two groups so that no conflicting pair is assigned to the same group. The model is valid only if every conflict is represented by an edge and the edge list is checked completely. An omitted edge could make an invalid assignment appear proper.

When recording a solution, give both the vertex set and the edge set (or an equivalent complete description of adjacency), state the two color classes, and check each edge. This makes the claim independently verifiable and makes errors—such as overlooking an edge within one part—easy to locate.

Check Your Understanding

For each question, use the definition directly and make the edge checks explicit.

  1. Let \(V=\{1,2,3,4\}\) and \(E=\{12,23,34\}\). Is assigning red to \(\{1,3\}\) and blue to \(\{2,4\}\) proper? List the color pair on each edge.
  2. For \(V=\{a,b,c,d\}\) and \(E=\{ab,ac,bd\}\), test the parts \(X=\{a,d\}\), \(Y=\{b,c\}\). Does every edge cross?
  3. Explain why changing the color of an isolated vertex cannot make an otherwise proper coloring improper.
  4. Give a proof that if a graph has an edge, then a proper coloring cannot assign the same color to every vertex.
  5. For a triangle with edges \(xy,yz,zx\), explain why checking just one failed coloring does not by itself prove that no proper two-coloring exists.