## Section 14.3 Chain partitioning

In Chapter 6, we discussed Dilworth’s Theorem, which told us that for any poset \(\bfP\) of width \(w\text{,}\) there is a partition of \(\bfP\) into \(w\text{,}\) but no fewer, chains. However, we were only able to devise an algorithm to find this chain partition (and a maximum antichain) in the special case where \(\bfP\) was an interval order. Now, through the magic of network flows, we will be able to devise an efficient algorithm that works in general for all posets. However, to do so, we will require a slightly more complicated network than we devised in the previous section.

Suppose that the points of our poset \(\bfP\) are \(\{x_1,x_2,\dots,x_n\}\text{.}\) We construct a network from \(\bfP\) consisting of the source \(S\text{,}\) sink \(T\text{,}\) and two points \(x'_i\) and \(x''_i\) for each point \(x_i\) of \(\bfP\text{.}\) All edges in our network will have capacity \(1\text{.}\) We add edges from \(S\) to \(x'_i\) for \(1\leq i\leq n\) and from \(x''_i\) to \(T\) for \(1\leq i\leq n\text{.}\) Of course, this network wouldn’t be too useful, as it has no edges from the single-prime nodes to the double-prime nodes. To resolve this, we add an edge directed from \(x'_i\) to \(x''_j\) if and only if \(x_i \lt x_j\) in \(\bfP\text{.}\)

Our running example in this section will be the poset in Figure 14.8.(a). We’ll discuss the points of the poset as \(x_i\) where \(i\) is the number printed next to the point in the diagram.

The first step is to create the network, which we show in Figure 14.8.(b). In this network, all capacities are \(1\text{,}\) edges are directed from bottom to top, the first row of ten vertices is the \(x'_i\) arranged consecutively with \(x'_1\) at the left and \(x'_{10}\) at the right, and the second row of ten vertices is the \(x''_i\) in increasing order of index. To see how this network is constructed, notice that \(x_1\lt x_3\) in the poset, so we have the directed edge \((x_1',x_3'')\text{.}\) Similarly, \(x_4\) is less than \(x_3\text{,}\) \(x_5\text{,}\) and \(x_9\) in the poset, leading to three directed edges leaving \(x_4'\) in the network. As a third example, since \(x_9\) is maximal in the poset, there are no directed edges leaving \(x_9'\text{.}\)

We have not yet seen how we might turn a maximum flow (or minimum cut) in the network we’ve just constructed into a minimum chain partition or a maximum antichain. It will be easier to see how this works once we have a confirmed maximum flow. Rather than running the labeling algorithm starting from the zero flow, we eyeball a flow, such as the one shown in Figure 14.9. (Again, we use the convention that thick edges are full, while thin edges are empty.)

When we run the labeling algorithm (using priority \(S,T,x_1',\dots,x_{10}',x_1'',\dots,x_{10}''\)), we obtain the following list of labels:

\begin{align*}
S:\quad \amp (*,+,\infty) \amp x''_9:\quad \amp (x'_5,+,1) \amp x'_3:\quad \amp (S,+,1)\\
x'_3:\quad \amp (S,+,1) \amp x''_4:\quad \amp (x'_6,+,1) \amp x''_1:\quad \amp (x'_7,+,1)\\
x'_5:\quad \amp (S,+,1)\amp x''_5:\quad \amp (x'_6,+,1) \amp x''_2:\quad \amp (x'_7,+,1)\\
x'_6:\quad \amp (S,+,1)\amp x'_1:\quad \amp (x''_3,-,1) \amp x'_2:\quad \amp (x'_7,+,1)\\
x'_9:\quad \amp (S,+,1)\amp x'_8:\quad \amp (x''_9,-,1) \amp T:\quad \amp (x''_2,+,1)\\
x''_3:\quad \amp (x'_5,+,1) \amp x'_7:\quad \amp (x''_4,-,1) \amp
\end{align*}

Thus, we find the augmenting path \((S,x'_6,x''_4,x'_7,x''_2,T)\text{,}\) and the updated flow can be seen in Figure 14.10.

If we run the labeling algorithm again, the algorithm assigns the labels below, leaving the sink unlabeled.

\begin{align*}
S:\quad \amp (*,+,\infty)\amp x'_5:\quad \amp (S,+,1) \amp x''_3:\quad
\amp (x'_5,+,1) \amp x'_1:\quad \amp (x''_3,-,1)\\
x'_3:\quad \amp (S,+,1) \amp x'_9:\quad \amp (S,+,1) \amp x''_9:\quad \amp (x'_5,+,1)
\amp x'_8:\quad \amp (x''_9,-,1)
\end{align*}

In Figure 14.10, the black vertices are those the labeled in the final run, while the gold vertices are the unlabeled vertices.

Now that we’ve gone over the part you already knew how to do, we need to discuss how to translate this network flow and cut into a chain partition and an antichain. If there is a unit of flow on an edge \((x_i',x_j'')\text{,}\) then a good first instinct is to place \(x_i\) and \(x_j\) in the same chain of a chain partition. To be able to do this successfully, of course, we need to ensure that this won’t result in two incomparable points being placed in a chain. A way to see that everything works as desired is to think of starting with \((x_i',x_j'')\) and then looking for flow leaving \(x_j'\text{.}\) If there is, it goes to a vertex \(x_k''\text{,}\) so we may add \(x_k\) to the chain since \(x_i\lt x_j\lt x_k\text{.}\) Continue in this manner until reaching a vertex in the network that does not have any flow leaving it. Then see if \(x_i''\) has flow coming into it. If it does, it’s from a vertex \(x_m'\) that can be added since \(x_m\lt x_i\lt x_j\text{.}\)

Let’s see how following this process for the flow in Figure 14.10 leads to a chain partition. If we start with \(x_1'\text{,}\) we see that \((x_1',x_3'')\) is full, so we place \(x_1\) and \(x_3\) in chain \(C_1\text{.}\) Since \(x_3'\) has no flow leaving it, there are no greater elements to add to the chain. However, \(x_1''\) has flow in from \(x_2'\text{,}\) so we add \(x_2\) to \(C_1\text{.}\) We now see that \(x_2''\) has flow in from \(x_7'\text{,}\) so now \(C_1=\{x_1,x_2,x_3,x_7\}\text{.}\) Vertex \(x_7''\) has no flow into it, so the building of the first chain stops. The first vertex we haven’t placed into a chain is \(x_4\text{,}\) so we note that \((x_4',x_5'')\) is full, placing \(x_4\) and \(x_5\) in chain \(C_2\text{.}\) We then look from \(x_5'\) and see no flow leaving. However, there is flow into \(x_4''\) from \(x_6'\text{,}\) so \(x_6\) is added to \(C_2\text{.}\) There is no flow out of \(x_6''\text{,}\) so \(C_2=\{x_4,x_5,x_6\}\text{.}\) Now the first point not in a chain is \(x_8\text{,}\) so we use the flow from \(x_8'\) to \(x_9''\) to place \(x_8\) and \(x_9\) in chain \(C_3\text{.}\) Again, no flow out of \(x_9'\text{,}\) so we look to \(x_8''\text{,}\) which is receiving flow from \(x_{10}''\text{.}\) Adding \(x_{10}\) to \(C_3\) gives \(C_3=\{x_8,x_9,x_{10}\}\text{,}\) and since every point is now in a chain, we may stop.

Even once we see that the above process does in fact generate a chain partition, it is not immediately clear that it’s a minimum chain partition. For this, we need to find an antichain of as many points as there are chains in our partition. (In the example we’ve been using, we need to find a three-element antichain.) This is where tracking the labeled vertices comes in handy. Suppose we have determined a chain \(C=\{x_1\lt x_2\lt \cdots \lt x_k\}\) using the network flow. Since \(x_1\) is the minimal element of this chain, there is no flow into \(x_1''\) and hence no flow out of \(x_1''\text{.}\) Since \(T\) is unlabeled, this must mean that \(x_1''\) is unlabeled. Similarly, \(x_k\) is the maximal element of \(C\text{,}\) so there is no flow out of \(x_k'\text{.}\) Thus, \(x_k'\) is labeled. Now considering the sequence of vertices

\begin{equation*}
x_k',x_k'',x_{k-1}',x_{k-1}'',\dots,x_2',x_2'',x_1',x_1'',
\end{equation*}

there must be a place where the vertices switch from being labeled to unlabeled. This must happen with \(x_i'\) labeled and \(x_i''\) unlabeled. To see why, suppose that \(x_i'\) and \(x_i''\) are both unlabeled while \(x_{i+1}'\) and \(x_{i+1}''\) are both labeled. Because \(x_i\) and \(x_{i+1}\) are consecutive in \(C\text{,}\) there is flow on \((x_i',x_{i+1}'')\text{.}\) Therefore, when scanning from \(x_{i+1}''\text{,}\) the vertex \(x_i'\) would be labeled. For each chain of the chain partition, we then take the first element \(y\) for which \(y'\) is labeled and \(y''\) is unlabeled to form an antichain \(A=\{y_1,\dots,y_w\}\text{.}\) To see that \(A\) is an antichain, notice that if \(y_i\lt y_j\text{,}\) then \((y_i',y_j'')\) is an edge in the network. Therefore, the scan from \(y_i'\) would label \(y_j''\text{.}\) Using this process, we find that a maximum antichain in our example is \(\{x_1,x_5,x_8\}\text{.}\)