`posets/text/canon` := TEXT(
` `,
`FUNCTION:  canon - canonically relabel a poset (or directed graph)`,
` `,
`CALLING SEQUENCE:  canon(P);    canon(P,'natural');`,
`                   canon(P,X);  canon(P,X,'natural');`,
`                   canon(P,n);  canon(P,n,'natural');`,
` `,
`PARAMETERS:  P = a poset`,
`             X = a set (the vertex set)`,
`             n = a positive integer (the number of vertices)`,
`   `,
`SYNOPSIS:`,
`  Two posets P and Q with vertex sets X and Y are isomorphic if there is`,
`  a bijection x -> x' from X to Y so that [x,y] is a relation in P if and`,
`  only if [x',y'] is a relation in Q.`,
`   `,
`  Given a poset P with a vertex set X of size n, canon(P,X) returns a new`,
`  poset isomorphic to P, with vertex set {1,...,n}, such that if (Q,Y)`,
`  is any other poset isomorphic to (P,X), then canon(Q,Y) = canon(P,X).`,
`  The output is a poset that need not be naturally labeled--there may be`,
`  relations [i,j] with i>j.`,
`   `,
`  canon(P,n) does the same, if the vertex set of P is {1,...,n}.`,
`  canon(P) does the same, assuming there are no isolated vertices.`,
`   `,
`  The algorithm operates correctly with arbitrary directed graphs.`,
`   `,
`  If the optional flag 'natural' is supplied, then the output will be a`,
`  canonical relabeling of the poset P that is natural. More generally,`,
`  this option can be used with any acyclic directed graph.`,
` `,
`EXAMPLES:`,
`  P:=chain(2) &* chain(3);`,
`  canon(P,6);          yields   {[6,2],[4,1],[2,1],[5,3],[6,4],[3,4],[5,6]}`,
`  canon(dual(P));      yields   {[6,2],[4,1],[2,1],[5,3],[6,4],[3,4],[5,6]}`,
`  P:={[a,b],[c,b],[c,d]};`,
`  canon(P,'natural');  yields                  {[2,4],[1,4],[2,3]}`,
` `,
`SEE ALSO:  autgroup, isom, rm_isom`,
NULL):

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