TITLE: Computing Bruhat Order Covering Relations
QUESTION [11 upvotes]: To put this in context:  I am in the process of developing a package for Macaulay 2 (a commutative algebra software,) called "Permutations", which will add permutations as a type of combinatorial object that M2 will handle, hopefully integrating nicely with the (still in development) Posets package, the (still in development) Graphs package, and various current M2 functions.
One of the first things that I'd wanted to put in was functions which compute the poset of the Bruhat order on $S_n$ and compute when one permutation covers another in the Bruhat order.  This was all coded and "working" - but has been producing a poset which is decidedly NOT the desired poset (among other things, the graph of the Hasse diagram isn't regular.)  I'd like to ask whether the (probably somewhat naive) algorithm I was using to check covering relations seems reasonable (so the problem is just in the coding of it, not in the theory behind it) or not.
To see if $P\leq R$ in the Bruhat order:
Given a pair of permutations P and R, compute their lengths (the number of simple transpositions in their decomposition, or [as implemented right now] the sum of entries in their inversion vectors.)  If length(P)=length(R)+1, then we compute
$(P^{-1})*R$.
If R covers P in the Bruhat order, then length$((P^{-1})*R)=1.$
Am I missing some subtlety of the Bruhat order?  I thought one permutation covered enough exactly when they differed by a single, simple transposition.  This seemed to capture that - but is giving me an incorrect poset.
Coding error or theory error?  I'd love to hear it.

REPLY [3 votes]: For  Stephen Griffeth and others:
download: http://math.univ-lyon1.fr/~ducloux/coxeter/coxeter3/english/coxeter3_e.html
To tell the software what group you want to work with, get yourself to the "type" prompt, either by pressing Enter at the main prompt, or by entering "type" as a command. The names of the groups are:

A-I, corresponding to the finite Coxeter groups
a-g, corresponding to the affine Coxeter groups
X or x, for input from a file
Y or y, for interactive input

For (1) (2) and (4) you will next be presented with the "rank" prompt, which refers to the size of the generating set of the Coxeter group, so for example the affine Weyl group of SL(3) should be "a" followed by "3". For (4) you will also be asked for the entries of the Coxeter matrix. For (3) you will be asked for a file.
When you need to enter a group element, you merely type a sequence of integers 1 through rank separated by periods, e.g. 1.2.1. If the rank is at most 9 then you can (must?) omit the periods, e.g. 121. If you need to input the identity element, you simply type nothing and press Enter. 
I don't remember how the simple reflections are numbered, but I seem to remember that the affine generator is always the last one. There is a prefix and postfix command to change these naming conventions (so you could call the 1st reflection "s(1)" if you wanted), which is useful when you are doing input from the output of some other program or script.
You can see a list of commands by typing "help", and they should be mostly self-explanatory knowing the above.