public static Permutation Parse( string text )
Public Shared Function Parse ( text As String ) As Permutation
public: static Permutation^ Parse( String^ text )
static member Parse : text : string -> Permutation
This method is able to parse both map representations and cycle representations of permutations.
A map representation of an n-dimensional permutation is a space-seperated list of all integers between 0 and n-1, enclosed in square brackets. Each number indicates the index of the location to which the object that appears at that location is mapped by the permutation. For example, [2 1 0] denotes the permutation that moves the object at index 0 to index 2, does not move the object at index 1, and moves the object at index 2 to index 0. Note that the numbers in the map representation are the same as the numbers on the second line of Cauchy's two-line notation.
A cycle representation of an n-dimensional representation is a space-seperated list of all integers between 0 and n-1, grouped into cycles by parenthesis. Each cycle indicates that the element at the location with the first index in the cycle is moved to the location with the second index in the cycle, the element at the location with the second index in the cycle is moved to the location with the third index in the cycle, and so on, until the element at the location with the last index is moved to the location with the first index. Thus (0 2)(1) indicates that the elements at locations 0 and 2 change places and the element at location 1 is left there.
Note that (0 2)(1) and [2 1 0] represent the same permutation.