/* * Step2: * Given a list L, representing the almost permutation form of a the correspodning braid (L) in the braid group B_N, * this programm its (left) permutation form, due to algorithm by Cha et al. "An Efficient Implementation of Braid Groups". * * input: N positiv integer (represents the braid index), L list (represents the almost permutation form of a braid in B_N) * output: L list (represents the permutation form of the input braid (L)) */ Define Step3(N,A) P := A[1]; Remove(A,1); L := Len(A); I := 1; D := FundBraid(N,TRUE); D := Pi(N,D); // Do left-weighted decomposition While I0) AND (A[1] = D) Do Remove(A,1); L := L-1; P := P+1; EndWhile; // Remove trivial-braids from right While (L>0) AND (A[L]=1..N) Do Remove(A,L); L := L-1; EndWhile; A := Concat([P],A); Return A; EndDefine;