`posets/text/ranked` := TEXT(
`   `,
`FUNCTION:  ranked - test whether a poset is ranked`,
` `,
`CALLING SEQUENCE:  ranked(P);    ranked(P,'R');`,
`                   ranked(P,X);  ranked(P,X,'R');`,
`                   ranked(P,n);  ranked(P,n,'R');`,
` `,
`PARAMETERS:  P = a poset`,
`             X = a set (the vertex set)`,
`             n = a positive integer (the number of vertices)`,
`             R = a name (optional)`,
`   `,
`SYNOPSIS:`,
`  A poset P with vertex set X is ranked if there exists an integer-valued`,
`  function r on X (the rank function) such that if y covers x in P, then`,
`  r[y]-r[x]=1. Note that the rank function is not unique.`,
`   `,
`  ranked(P,X) returns true or false according to whether P is ranked.`,
`  ranked(P,n) does the same, if the vertex set of P is {1,2,...,n}.`,
`  ranked(P) does the same, assuming that P has no isolated vertices.`,
`   `,
`  Optionally, if P is ranked and the last argument is an unassigned name,`,
`  such as R, then as a side effect the procedure will assign to R a list`,
`  [X_0, X_1, ..., X_m], where X_i is the set of vertices of rank i, using`,
`  the (unique) rank function with the property that the minimum rank in`,
`  every connected component of P is 0.`,
`   `,
`  A poset P is graded if all maximal chains have the same length,`,
`  or equivalently, if the poset ({},1) &+ (P,X) &+ ({},1) obtained by`,
`  adjoining a maximum and minimum element is ranked.`,
`   `,
`EXAMPLES:`,
`  P:=({},1) &+ (chain(2),3) &+ ({},1);`,
`  ranked(P,6);                       yields             false`,
`  P:={[1,2],[2,3],[4,3],[4,5]};`,
`  ranked(P);                         yields              true`,
`  ranked(P &u dual(P),'R'),R;        yields`,
`                                       true, [{1,8,10},{2,4,7,9},{3,5,6}]`,
`   `,
`SEE ALSO:  connected, filter`,
NULL):

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