1 #ifndef MUSTER_BINOMIAL_H
2 #define MUSTER_BINOMIAL_H
20 std::vector<int>
children(
int rank)
const;
21 int parent(
int rank)
const;
23 int size()
const {
return _size; }
24 int root()
const {
return _root; }
27 template <
class OutputIterator>
30 for (
int mask = 0x1; mask < _size; mask <<= 1) {
31 if ((mask & relrank) != 0) {
35 int child = (relrank | mask);
37 *o++ = (child + _root) % _size;
45 #endif // MUSTER_BINOMIAL_H
binomial_embedding(int size, int root=0)
Construct a binomial rank embedding with size nodes, rooted at root.
int reverse_relative_rank(int rank) const
Reverse rank permutation.
std::vector< int > children(int rank) const
Same as get_children, but returns vector.
int parent(int rank) const
Get the parent of a particular rank.
int relative_rank(int rank) const
This permutes ranks in case the root is not zero.
void get_children(int rank, OutputIterator o) const
This allows you to putting children into any structure that supports output iterators.