Class Permutor

java.lang.Object
org.openscience.cdk.smsd.labelling.Permutor
Direct Known Subclasses:
AtomContainerAtomPermutor

@Deprecated public class Permutor extends Object
Deprecated.
This class is part of SMSD and either duplicates functionality elsewhere in the CDK or provides public access to internal implementation details. SMSD has been deprecated from the CDK with a newer, more recent version of SMSD is available at http://github.com/asad/smsd.
General permutation generator, that uses orderly generation by ranking and unranking. The basic idea is that all permutations of length N can be ordered (lexicographically) like:
 0 [0, 1, 2]
 1 [0, 2, 1]
 2 [1, 0, 2]
 ...
 
where the number to the left of each permutation is the rank - really just the index in this ordered list. The list is created on demand, by a process called unranking where the rank is converted to the permutation that appears at that point in the list.

The algorithms used are from the book "Combinatorial Generation : Algorithms, Generation, and Search" (or C.A.G.E.S.) by D.L. Kreher and D.R. Stinson

Author:
maclean
Source code:
main
  • Constructor Summary

    Constructors
    Constructor
    Description
    Permutor(int size)
    Deprecated.
    Create a permutor that will generate permutations of numbers up to size.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Deprecated.
    Calculate the max possible rank for permutations of N numbers.
    int[]
    Deprecated.
    Get the permutation that is currently being used.
    int[]
    Deprecated.
    Get the next permutation in the list.
    int[]
    Deprecated.
    Randomly skip ahead in the list of permutations.
    int
    Deprecated.
     
    boolean
    Deprecated.
     
    void
    setPermutation(int[] permutation)
    Deprecated.
    Set the currently used permutation.
    void
    setRank(int rank)
    Deprecated.
    Set the permutation to use, given its rank.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Permutor

      public Permutor(int size)
      Deprecated.
      Create a permutor that will generate permutations of numbers up to size.
      Parameters:
      size - the size of the permutations to generate
  • Method Details

    • hasNext

      public boolean hasNext()
      Deprecated.
    • setRank

      public void setRank(int rank)
      Deprecated.
      Set the permutation to use, given its rank.
      Parameters:
      rank - the order of the permutation in the list
    • getRank

      public int getRank()
      Deprecated.
    • setPermutation

      public void setPermutation(int[] permutation)
      Deprecated.
      Set the currently used permutation.
      Parameters:
      permutation - the permutation to use, as an int array
    • getRandomNextPermutation

      public int[] getRandomNextPermutation()
      Deprecated.
      Randomly skip ahead in the list of permutations.
      Returns:
      a permutation in the range (current, N!)
    • getNextPermutation

      public int[] getNextPermutation()
      Deprecated.
      Get the next permutation in the list.
      Returns:
      the next permutation
    • getCurrentPermutation

      public int[] getCurrentPermutation()
      Deprecated.
      Get the permutation that is currently being used.
      Returns:
      the permutation as an int array
    • calculateMaxRank

      public int calculateMaxRank()
      Deprecated.
      Calculate the max possible rank for permutations of N numbers.
      Returns:
      the maximum number of permutations