# Applied Combinatorics

## Section6.4Linear Extensions of Partially Ordered Sets

Let $$\PXP$$ be a partially ordered set. A linear order $$L$$ on $$X$$ is called a linear extension (also, a topological sort) of $$P\text{,}$$ if $$x\lt y$$ in $$L$$ whenever $$x\lt y$$ in $$P\text{.}$$ For example, the table displayed in Figure 6.23 shows that our familiar example $$\bfP_3$$ has 11 linear extensions.

### Discussion6.24.

Bob says that he is not convinced that every finite poset has a linear extension. Alice says that it is easy to show that they do. Is she right?
Carlos says that there are subtleties to this question when the ground set $$X$$ is infinite. You might want to do a web search on the name Szpilrajn and read about his contribution to this issue.
The classical sorting problem studied in all elementary computer science courses is to determine an unknown linear order $$L$$ of a set $$X$$ by asking a series of questions of the form: Is $$x\lt y$$ in $$L\text{?}$$ All the well known sorting algorithms (bubble sort, merge sort, quick sort, etc.) proceed in this manner.
Here is an important special case: determine an unknown linear extension $$L$$ of a poset $$\bfP$$ by asking a series of questions of the form: Is $$x \lt y$$ in $$L\text{?}$$

### Discussion6.25.

Given the poset $$\PXP$$ shown in Figure 6.5 and the problem of determining an unknown linear extension of $$P\text{,}$$ how should Alice decide which question (of the form: Is $$x\lt y$$ in $$L\text{?}$$) to ask?
How would you like to be assigned to count the number of linear extensions of this poset? In general, how hard is it to determine the number of linear extensions of a poset? Could you (and your computer) do this count for a poset on $$100,000$$ points?