Generates SubsetDelta structs for subsets of fixed length. More...
#include <SubsetDeltaGenerator.hpp>
Public Member Functions | |
SubsetDeltaGenerator (unsigned int n) | |
Constructor. Initializes generator for subsets of fixed size of the set { 0, 1, 2, 3, ..., n - 1 }. | |
~SubsetDeltaGenerator () | |
Destructor. Called automatically, cleans up memory used by the object. | |
void | getDeltasForSubsetsOfFixedLength (unsigned int k, std::vector< SubsetDelta > &deltas) |
Compute a list of minimum changes needed to change one subset to the next in the list. Starting with the subset { 0, 1, 2, ..., k - 1 }, each SubsetDelta struct indicates what item needs to be replaced, and what to replace it with in order to get the next subset in the list. |
Generates SubsetDelta structs for subsets of fixed length.
Uses the algorithm described in the paper "An Algorithm for Generating Subsets of Fixed Size with a Strong Minimal Change Property" by Peter Eades and Brendan McKay.
Definition at line 28 of file SubsetDeltaGenerator.hpp.
SubsetDeltaGenerator::SubsetDeltaGenerator | ( | unsigned int | n | ) |
Constructor. Initializes generator for subsets of fixed size of the set { 0, 1, 2, 3, ..., n - 1 }.
n | Number of items in the set to make subsets of. |
Definition at line 11 of file SubsetDeltaGenerator.cpp.
void SubsetDeltaGenerator::getDeltasForSubsetsOfFixedLength | ( | unsigned int | k, | |
std::vector< SubsetDelta > & | deltas | |||
) |
Compute a list of minimum changes needed to change one subset to the next in the list. Starting with the subset { 0, 1, 2, ..., k - 1 }, each SubsetDelta struct indicates what item needs to be replaced, and what to replace it with in order to get the next subset in the list.
k | Desired fixed size for the subsets. | |
deltas | Vector which will hold the deltas as described above. |
Definition at line 27 of file SubsetDeltaGenerator.cpp.