# Section6.4Linear Extensions of Partially Ordered Sets¶ permalink

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

\begin{equation*} \begin{array}{ccccccccccc} L_1\amp L_2 \amp L_3 \amp L_4 \amp L_5 \amp L_6 \amp L_7 \amp L_8 \amp L_9 \amp L_{10} \amp L_{11}\\[.2in] d \amp d \amp d \amp b \amp d \amp d \amp d \amp b \amp d \amp d \amp b \\ c \amp c \amp b \amp d \amp c \amp c \amp b \amp d \amp c \amp b \amp d \\ w \amp b \amp c \amp c \amp w \amp b \amp c \amp c \amp b \amp c \amp c \\ b \amp w \amp w \amp w \amp b \amp w \amp w \amp w \amp z \amp z \amp z \\ a \amp a \amp a \amp a \amp z \amp z \amp z \amp z \amp w \amp w \amp w \\ z \amp z \amp z \amp z \amp a \amp a \amp a \amp a \amp a \amp a \amp a \\ \end{array} \end{equation*}

##### 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$? 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$?

##### Discussion6.25

Given the poset $\PXP$ shown in Figure 6.5 and the problem of determining an unknown linear extension of $P$, how should Alice decide which question (of the form: Is $x\lt y$ in $L$?) 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?