`posets/text/extensions` := TEXT(
` `,
`FUNCTION:  extensions - linear extensions of a poset (or acyclic digraph)`,
` `,
`CALLING SEQUENCE:  extensions(P);`,
`                   extensions(P,X);`,
`                   extensions(P,n);`,
` `,
`PARAMETERS:  P = a poset`,
`             X = a set (the vertex set)`,
`             n = a positive integer (the number of vertices)`,
`   `,
`SYNOPSIS:`,
`  A linear extension of a poset P with vertex set X is a linear ordering `,
`  [x_1,...,x_n] of X so that x_i < x_j in P implies i < j.`,
`   `,
`  extensions(P,X) returns a list of all linear extensions of the poset P.`,
`  extensions(P,n) does the same, if the vertex set of P is {1,...,n}.`,
`  extensions(P) does the same, assuming that P has no isolated vertices.`,
`   `,
`  The procedure also operates correctly on acyclic digraphs.`,
`   `,
`  To quickly generate a single linear extension, use map(op,filter(P,X)).`,
`   `,
`  To quickly count the linear extensions of P, use W(P,X,1,1).`,
`   `,
`EXAMPLES:`,
`  extensions({[1,2]},3);              yields   [[1,2,3], [1,3,2], [3,1,2]]`,
`  extensions({[1,2]});                yields            [[1, 2]]`,
`  extensions({[a,b],[a,c]},{a,b,c});  yields       [[a,b,c], [a,c,b]]`,
` `,
`SEE ALSO:  filter, W`,
NULL):

if `+`(0)=0 then # Maple V.4 or later
  print(INTERFACE_HELP(insert, topic=`posets/extensions`,
  helpfile=HomeLib, text=`posets/text/extensions`))
elif ceil(0)=0 then # Maple V.2 or V.3
  `help/posets/text/extensions`:=`posets/text/extensions`:
  save `help/posets/text/extensions`, cat(HomeLib,`/help/posets/text/extensions.m`)
fi:
