Tutorials › Graph Theory (Undergraduate) › Odd-Vertex Pairing for the Undirected Chinese Postman

Eulerian Trails and Circuits · Tutorial 83 of 799

Odd-Vertex Pairing for the Undirected Chinese Postman

Learn why pairing odd-degree vertices by shortest-path cost produces the least additional edge cost for an undirected postman route.

Intermediate 10 min read

What You'll Learn

  • Identify the odd-degree vertices that must be corrected.
  • Compute shortest-path costs between those vertices.
  • Compare perfect matchings by their total path cost.
  • Prove why every optimal route corresponds to a minimum-cost pairing.
  • Duplicate the chosen paths and check the resulting degrees and route cost.
  • Recognize why direct-edge costs are not enough.

From Edge Duplication to Pairing

An undirected postman route must be a closed walk that traverses every edge at least once. If the graph already has an Euler circuit, no edge needs to be repeated. Otherwise, some edge traversals must be added so that the resulting multigraph has even degree at every vertex. The key question is how to add them as cheaply as possible.

Assume throughout that \(G=(V,E)\) is a finite, connected, undirected simple graph with at least one edge, and that each edge \(e\) has a positive traversal cost \(c(e)\). A route’s cost is the sum of the costs of all its traversals, counting repeated traversals each time. The original edges must each be traversed at least once. Write \(O\) for the set of vertices of odd degree in \(G\).

Definition: A perfect matching of a finite set \(O\) is a collection of disjoint pairs that includes every element of \(O\) exactly once. The cost of a pair \(\{u,v\}\) is the length of a shortest \(u\)-\(v\) path in \(G\), where path length is the sum of its edge costs. The cost of a perfect matching is the sum of its pair costs.

The handshake lemma implies that \(|O|\) is even, so such pairings exist, including the empty pairing when \(O=\varnothing\). Because \(G\) is finite and connected, a shortest path exists between every pair of vertices. The costs used in a pairing are therefore distances through the graph, not necessarily costs of single edges.

Theorem: The least additional cost needed for an undirected postman route is the minimum cost of a perfect matching of \(O\). To obtain an optimal route, choose such a matching, duplicate one shortest path for each paired pair, and traverse every edge of the resulting connected multigraph in an Euler circuit.

Why the Pairing Gives the Optimum

We use the Euler-circuit characterization established in the earlier material: a connected undirected multigraph has an Euler circuit if and only if every vertex has even degree. The duplicated paths turn the original graph into a connected multigraph, since the original graph is connected and adding edge copies cannot disconnect it.

Proof. First choose any perfect matching of \(O\), and for each pair choose a shortest path in \(G\). Duplicate every edge once for each time it occurs in these paths. Consider a vertex \(v\). A path contributes an even number of incident edge copies at any internal vertex, and an odd number at each of its two endpoints. Since each odd vertex is an endpoint of exactly one chosen pair, the total number of added incidences at \(v\) is odd exactly when \(v\in O\). Thus a vertex that originally had odd degree receives an odd number of added incidences, and a vertex that originally had even degree receives an even number. In both cases its degree in the augmented multigraph is even. The multigraph is connected, so it has an Euler circuit. That circuit traverses every original edge and has additional cost equal to the matching cost. Taking a minimum-cost matching shows that the least additional cost is at most the minimum matching cost.

For the reverse inequality, take any closed postman route and count its traversals of each edge. For every original edge, at least one traversal is required. Regard one traversal as the original edge and all further traversals as added copies. The resulting multigraph has even degree at every vertex because the route is closed. Consequently, the added copies have odd degree exactly at the vertices in \(O\): adding degrees modulo \(2\), an originally odd degree needs an odd added degree to become even, while an originally even degree needs an even added degree.

Consider the multigraph consisting only of the added copies. In any connected component containing added edges, the number of its odd-degree vertices is even, by the handshake lemma. If that number is positive, add one new vertex and join it by one new edge to each odd-degree vertex of the component. The enlarged component is connected and every degree is even. Its Euler circuit, with the new edges removed, separates the added edges into trails whose endpoints are paired odd-degree vertices: each time the circuit passes through the new vertex, the segment between consecutive new edges is a trail in the added-edge component. Components with no odd-degree vertices need no pairing; their added-edge costs are nonnegative.

Each trail between a paired pair \(u,v\) has cost at least the shortest-path distance from \(u\) to \(v\) in \(G\). Indeed, a trail in the added copies is also a walk using edges of \(G\), and removing repeated portions cannot produce a path of greater cost because all edge costs are positive. The trails therefore give a perfect matching of \(O\) whose cost is at most the total cost of all added copies. The minimum matching cost is no larger than that route’s additional cost. This holds for every postman route, so the minimum matching cost is at most the least additional cost. Combining the two inequalities proves equality. \(\square\)

If \(O=\varnothing\), the matching is empty and has cost zero. The original graph is connected and all its degrees are even, so it already has an Euler circuit. Thus the result also covers this case.

Worked Examples

Worked Example: Four Odd Vertices in a Weighted Complete Graph

Let \(V=\{a,b,c,d\}\), with all six edges of \(K_4\), and costs \(c(ab)=1\), \(c(ac)=4\), \(c(ad)=5\), \(c(bc)=2\), \(c(bd)=4\), and \(c(cd)=1\). Each vertex has degree \(3\), so \(O=\{a,b,c,d\}\). Find the optimal additional cost.

Compute the shortest-path distances needed for the three pairings. For \(a,c\), the path \(a-b-c\) costs \(1+2=3\), less than the direct edge cost \(4\), so \(d(a,c)=3\). For \(a,d\), the path \(a-b-c-d\) costs \(1+2+1=4\), less than the direct edge cost \(5\), so \(d(a,d)=4\). For \(b,d\), the path \(b-c-d\) costs \(2+1=3\), less than the direct edge cost \(4\), so \(d(b,d)=3\). The remaining distances are \(d(a,b)=1\), \(d(b,c)=2\), and \(d(c,d)=1\), since the direct edges have those costs and all costs are positive.

The three possible perfect matchings have costs:

  • \(\{a,b\},\{c,d\}\): \(1+1=2\).
  • \(\{a,c\},\{b,d\}\): \(3+3=6\).
  • \(\{a,d\},\{b,c\}\): \(4+2=6\).

The minimum pairing is \(\{a,b\},\{c,d\}\). Duplicate \(ab\) and \(cd\), adding cost \(1+1=2\). Each original degree was \(3\); the added edge raises each vertex’s degree by \(1\), making all four degrees \(4\). The augmented graph is connected and even-degree, so it has an Euler circuit.

Check: The original edge cost is \(1+4+5+2+4+1=17\). The route cost is therefore \(17+2=19\). The other two pairings give routes of cost \(17+6=23\), so this comparison confirms that the chosen pairing is cheapest.

Worked Example: Pairing Across a Star

Let \(V=\{o,a,b,c\}\), \(E=\{oa,ob,oc\}\), and give each edge cost \(1\). The center \(o\) has degree \(3\), and each leaf has degree \(1\), so \(O=\{o,a,b,c\}\).

Every perfect matching pairs \(o\) with one leaf and pairs the other two leaves together. The center-to-leaf distance is \(1\). Any two distinct leaves, such as \(a\) and \(b\), have shortest path \(a-o-b\), of cost \(1+1=2\). Thus each possible matching costs \(1+2=3\). Choose \(\{o,a\}\) and \(\{b,c\}\), and duplicate the edge \(oa\) and the path \(b-o-c\). The additional cost is \(1+1+1=3\).

The added incidences at \(o\) total \(1+2=3\), and each leaf receives one. Hence the augmented degrees are \(3+3=6\) at \(o\) and \(1+1=2\) at each leaf. All degrees are even. The original cost is \(1+1+1=3\), so the resulting route costs \(3+3=6\).

Check: One Euler circuit traverses \(oa,ob,oc,co,bo,oa\), with total cost \(1+1+1+1+1+1=6\). It covers all three original edges and repeats precisely the three added traversals.

Worked Example: Two Odd Vertices in a Weighted Path

Let \(V=\{a,b,c,d\}\), \(E=\{ab,bc,cd\}\), with costs \(c(ab)=1\), \(c(bc)=2\), and \(c(cd)=1\). Vertices \(a,d\) have degree \(1\), while \(b,c\) have degree \(2\), so \(O=\{a,d\}\). There is only one perfect matching, pairing \(a\) with \(d\).

The only \(a\)-\(d\) path is \(a-b-c-d\), with cost \(1+2+1=4\). Duplicate all three edges of this path, for additional cost \(4\). The augmented degrees are \(2\) at \(a,d\) and \(4\) at \(b,c\), so the augmented graph has an Euler circuit.

Check: The route \(a-b-c-d-c-b-a\) traverses each edge twice and has cost \(1+2+1+1+2+1=8\). The original cost is \(1+2+1=4\), and the additional cost is \(8-4=4\), matching the pairing calculation.

Using the Method

1
Find the odd vertices.
Compute each degree in the original graph and collect the odd-degree vertices in \(O\). The handshake lemma ensures that their number is even.
2
Calculate pair costs.
For each pair of vertices in \(O\), find a shortest-path distance in the original graph, using edge traversal costs.
3
Choose a minimum-cost perfect matching.
Add the distances of its pairs and compare with the costs of other possible pairings.
4
Duplicate the paths and take an Euler circuit.
Duplicate one shortest path for each matched pair. The resulting connected multigraph has even degrees, so an Euler circuit gives a postman route.

The pairing calculation determines the least additional cost; it does not mean that each matched pair must be connected by a single edge. A shortest path may contain several edges, and different chosen paths may use the same edge. If an edge occurs in more than one chosen path, duplicate it once for each occurrence: the argument counts added traversals with multiplicity.

Common Pitfall: Using Direct Edge Costs

In the star example, the leaves \(b,c\) are not adjacent. Treating their pair cost as unavailable because there is no direct edge would incorrectly rule out a perfect matching. Their correct pair cost is the shortest-path cost \(d(b,c)=1+1=2\), using the path through \(o\). The matching \(\{o,a\},\{b,c\}\) then has total cost \(1+2=3\).

Another error is to pair only vertices whose original edge is already present. The theorem concerns shortest paths between every pair of odd vertices in the connected graph. It is the paths’ traversal costs, not just the costs of existing direct edges between odd vertices, that determine the optimal duplication.

Check Your Understanding

For each question, use shortest-path costs and count every duplicated traversal.

  1. In the weighted graph with \(V=\{a,b,c,d\}\) and edges \(ab,bc,cd,da,ac\) of costs \(1,2,1,3,2\), respectively, find \(O\) and list the possible perfect matchings.
  2. Explain why duplicating a path changes the parity of the degrees at its endpoints but not at its internal vertices.
  3. For the star with center \(o\) and three leaves, why is the cost of pairing two leaves \(2\), even though they are not adjacent?
  4. If \(O=\varnothing\), what is the minimum additional cost, and what result ensures a postman route exists?
  5. Suppose two chosen shortest paths both use the same edge. How many added traversals of that edge must be counted?