Tutorials › Graph Theory (Undergraduate) › Alternating Paths for Bipartite Edge Recoloring

Edge Coloring · Tutorial 387 of 799

Alternating Paths for Bipartite Edge Recoloring

Use alternating paths to recolor edges safely, track the effect on endpoint color availability, and verify each exchange on explicit bipartite graphs.

Advanced 9 min read

What You'll Learn

  • Identify the path and cycle components formed by two chosen colors in a proper edge coloring.
  • Exchange two colors on an alternating component and explain why properness is preserved.
  • Track how a path’s length determines the color changes at its endpoints.
  • Distinguish the total number of recolored edges from the individual counts of each color.
  • Use a path exchange to change the colors available at the ends of an uncolored edge.

Two Colors Isolate a Recoloring Route

In an edge coloring, changing one edge at a time can create a conflict: two edges meeting at a vertex might end up with the same color. Alternating paths give a controlled alternative. If the edges of a path alternate between two colors, exchanging those colors along the path keeps every internal vertex properly colored. The endpoints may change which of the two colors is available, which is the useful effect in many recoloring arguments.

All graphs in this tutorial are finite and simple. A proper edge coloring assigns colors to some or all edges so that any two colored edges sharing a vertex have different colors. A coloring may be partial: some edges may be uncolored. A color \(c\) is missing at a vertex \(v\) if no colored edge incident with \(v\) has color \(c\). An alternating path for two distinct colors \(a,b\) is a path whose consecutive edges alternate between \(a\) and \(b\).

Definition: Given a proper edge coloring and two colors \(a,b\), the two-color subgraph has as its edges exactly the edges colored \(a\) or \(b\), and as its vertices the endpoints of those edges. A two-color component is a connected component of this subgraph.

We focus on bipartite graphs: a graph is bipartite if its vertices can be partitioned into two sets so that every edge joins one set to the other. Bipartiteness provides a useful parity rule: along any path the vertices alternate between the two sets. The local recoloring operation itself works in any graph; the bipartite setting makes the path parity especially informative.

The Shape of a Two-Color Component

Lemma: In a proper edge coloring, every two-color component is a path or a cycle, and its edges alternate between the two colors.

Proof. At any vertex, at most one incident edge can have color \(a\) and at most one can have color \(b\), because the coloring is proper. Thus every vertex of the two-color subgraph has degree at most \(2\). If a vertex has degree \(2\), its two incident edges have different colors, again by properness. Therefore colors alternate whenever we continue through a vertex of degree \(2\).

Now consider a connected component containing at least one edge. If it has a vertex of degree \(1\), start there and follow the only edge; at each subsequent vertex there is at most one unused edge to continue along. No vertex can be revisited: a revisit would close a cycle, and a vertex on that cycle would then have its two cycle edges, leaving no way for the original degree-\(1\) start to connect to it without giving some vertex degree at least \(3\). Finiteness therefore makes this traversal end at another degree-\(1\) vertex, and connectedness means it has covered the component. The component is a path. If there is no degree-\(1\) vertex, every vertex has degree \(2\). Following edges must eventually revisit a vertex, forming a cycle; each vertex on the cycle already has degree \(2\), so connectedness leaves no other vertices or edges in the component. It is a cycle. In both cases, the colors alternate at every degree-\(2\) vertex. \(\square\)

In a bipartite graph, every cycle has even length because each step changes sides and returning to the starting side requires an even number of steps. An alternating cycle also has even length: its edge colors alternate, and the last edge must have a different color from the first at their shared vertex. For an alternating path, the first and last edge colors are the same exactly when the path has odd length.

Exchanging the Colors

Theorem: Let a proper edge coloring be given, and let \(H\) be a two-color component for distinct colors \(a,b\). Replacing \(a\) by \(b\) and \(b\) by \(a\) on every edge of \(H\), leaving all other edges unchanged, gives another proper edge coloring.

Proof. We check every vertex that could be affected. At a vertex of \(H\) incident with two edges of \(H\), one has color \(a\) and the other has color \(b\). After the exchange, they still have different colors. At a vertex incident with exactly one edge of \(H\), that edge changes from one of \(a,b\) to the other. There cannot be another incident edge of either color outside \(H\): any such edge would belong to the two-color subgraph and be connected to \(H\), hence would itself be in the same component. All other incident colored edges have colors different from both \(a\) and \(b\), so the changed edge conflicts with none of them. Vertices not incident with \(H\) are unchanged. Thus no pair of incident colored edges receives the same color, and the new coloring is proper. \(\square\)

The exchange preserves the total number of edges in \(H\), but it swaps the counts of the two colors there. It does not generally preserve the individual counts. On an alternating cycle, or an even-length alternating path, the counts are equal, so swapping leaves each individual count unchanged. On an odd-length path, one color occurs once more than the other, and the exchange reverses which color has the larger count.

Endpoint rule: On an alternating path component, each endpoint has exactly one incident edge in the two-color subgraph. Its incident color changes under the exchange, so its availability of \(a\) and \(b\) is reversed. At an internal vertex, one edge of each color remains incident before and after the exchange, so neither color becomes newly available there.

In a bipartite graph, a path with an even number of edges has its endpoints in the same part, while a path with an odd number of edges has its endpoints in opposite parts. This follows by changing parts once for every edge traversed. The endpoint rule and the parity rule can therefore be used together when a recoloring argument needs to coordinate the colors available at two vertices.

Worked Example: Swapping Colors on an Even-Length Path

Let \(G\) be the path with \(V=\{1,2,3,4,5\}\) and \(E=\{12,23,34,45\}\). It is bipartite, with parts \(\{1,3,5\}\) and \(\{2,4\}\). Color \(12\) and \(34\) red, and color \(23\) and \(45\) blue. The path alternates red, blue, red, blue.

The red count is \(2\), from edges \(12,34\); the blue count is \(2\), from \(23,45\). Exchange the colors on the whole path. The new colors, in edge order \(12,23,34,45\), are blue, red, blue, red. At each internal vertex, the two incident edges still have different colors. Each endpoint has only one colored incident edge, so neither can have a conflict.

Check: after the exchange, the red edges are \(23,45\), giving red count \(2\), and the blue edges are \(12,34\), giving blue count \(2\). The total remains \(4\). The endpoints \(1,5\) are in the same bipartition part, as expected for a path of length \(4\).

Worked Example: An Odd-Length Path Swaps Unequal Counts

Let \(G\) have \(V=\{1,2,3,4\}\), \(E=\{12,23,34\}\), and bipartition \(\{1,3\},\{2,4\}\). Color \(12\) red, \(23\) blue, and \(34\) red. This is a proper coloring: at vertex \(2\) the incident colors are red and blue, and at vertex \(3\) they are blue and red.

Before recoloring, the red count on the path is \(2\) and the blue count is \(1\), for a total of \(3\) edges. Swapping red and blue gives \(12\) blue, \(23\) red, and \(34\) blue. The new red count is \(1\), the new blue count is \(2\), and the total is still \(3\). At each internal vertex there remains one red and one blue edge. At endpoint \(1\), the incident edge changes red to blue; at endpoint \(4\), its incident edge also changes red to blue. The endpoints are in opposite bipartition parts, as expected for a path of length \(3\).

Check: the counts have swapped from \((2,1)\) to \((1,2)\), where the ordered pair lists (red count, blue count). The coloring remains proper at vertices \(2\) and \(3\) because each still has one edge of each color, and the degree-one endpoints cannot create a conflict.

Using an Exchange to Change Endpoint Availability

A recoloring is often useful because it changes what can be done at an endpoint, rather than because it changes the number of edges of each color. In a partial coloring, an uncolored edge can be colored \(c\) if \(c\) is missing at both endpoints. An alternating-path exchange can change which of the two colors is missing at the path endpoints while leaving the internal vertices properly colored.

Worked Example: Recoloring to Color an Uncolored Edge

Let \(G\) have \(V=\{1,2,3,4\}\) and \(E=\{12,23,34,14\}\). This is bipartite with parts \(\{1,3\}\) and \(\{2,4\}\). Give \(12\) color red, \(23\) color blue, and \(34\) color red; leave \(14\) uncolored. The colored edges form the alternating path \(1,2,3,4\).

Initially, red is missing at neither endpoint of \(14\): edge \(12\) is red at vertex \(1\), and edge \(34\) is red at vertex \(4\). Blue is missing at both endpoints, since each has only one colored incident edge and that edge is red. Thus \(14\) can be colored blue immediately.

Alternatively, exchange red and blue on the path \(1,2,3,4\). Its three edge colors become blue, red, blue in order. Now red is missing at both \(1\) and \(4\), so color \(14\) red. The resulting coloring is proper: at vertex \(1\), edges \(12\) and \(14\) are blue and red; at vertex \(4\), edges \(34\) and \(14\) are blue and red; at vertices \(2\) and \(3\), the two colored incident edges also have different colors.

Check: before the exchange, the path had \(2\) red edges and \(1\) blue edge. After it, the path has \(1\) red edge and \(2\) blue edges. Adding the newly colored edge \(14\) in red makes the final counts \(2\) red and \(2\) blue. There are \(4\) edges in \(G\), and all \(4\) are now colored. The edge set includes the 4-cycle \(1,2,3,4,1\), consistent with the bipartition.

Common Pitfall: Confusing Total and Individual Counts

A frequent error is to say that exchanging two colors on an alternating component “preserves the number of edges of each color.” It preserves the number of edges in the component, not necessarily the count of each color separately. In the odd-length path example, the incorrect calculation would leave the counts at red \(2\), blue \(1\). But the actual new edge colors are blue, red, blue, so the correct counts are red \(1\), blue \(2\). Individual counts stay equal only when they were equal before the exchange.

Another mistake is to exchange colors on an arbitrary collection of edges and assume properness follows. The component condition matters: at every internal vertex of an alternating component, there is one edge of each color, and swapping them retains that pattern. If one recolors only part of a route without checking its endpoints and internal vertices, a conflict may result. For a reliable argument, identify the two-color component, verify the alternating sequence, and then check the endpoints separately from the internal vertices.

These exchanges are a local tool, not a complete edge-coloring algorithm by themselves. They do not assert that every partial coloring can be extended, nor do they determine the minimum number of colors required. Their precise guarantee is that swapping the two colors on a full two-color component preserves properness and reverses the two-color availability at its path endpoints.

Check Your Understanding

For each question, state the relevant path length or component structure and verify the color counts when an exchange is made.

  1. In a proper edge coloring, why can a vertex have at most two incident edges in the subgraph formed by two selected colors?
  2. An alternating path has five edges, starts with green, and uses only green and orange. How many edges of each color does it have before and after a full exchange?
  3. Explain why a full two-color cycle has equal counts of its two colors and why swapping them preserves each count.
  4. In a bipartite graph, what can be concluded about the parts containing the endpoints of an alternating path with four edges?
  5. Give a reason an exchange on only part of a two-color component might fail to preserve properness.