The poset $P$ is ranked if there exists an integer function $r$ on the vertex set of $P$ such that for each $a$ and $b$ in the poset if $b$ covers $a$ then $r(b) - r(a) = 1$.
This method returns one such ranking function.
i1 : (chain 5).GroundSet
o1 = {1, 2, 3, 4, 5}
o1 : List
|
i2 : rankFunction chain 5
o2 = {0, 1, 2, 3, 4}
o2 : List
|
i3 : (booleanLattice 3).GroundSet
o3 = {000, 001, 010, 011, 100, 101, 110, 111}
o3 : List
|
i4 : rankFunction booleanLattice 3
o4 = {0, 1, 1, 2, 1, 2, 2, 3}
o4 : List
|
This method was ported from John Stembridge's Maple package available at http://www.math.lsa.umich.edu/~jrs/maple.html#posets.
The object rankFunction is a method function.