Are there fast rank and unrank algorithms for integer vectors under the action of a permutation group?
Imported on
The forum classified this question as unanswered when collected. This does not certify an open research problem; check the answers and revision history at the source.
Read the question with its definitions and background below. The source provides the full formulation and further discussion; the glossary and Wikipedia links offer additional reading aids.
Problem statement
We are distributing indistinguishable balls in numbered boxes . A distribution is a tuple of nonnegative integers whose sum is . We also have a permutation group acting on , and two distributions are considered equivalent, if there is a permutation such that for all . Denote the set of the equivalence classes by . An equivalence class can be represented by some canonical element of it, for example the distribution that comes first in reverse lexical order.
Question: Are there known fast rank and unrank algorithms for ?
A rank function is a bijection , and its inverse is an unrank function. So the unranking gives "the th member", in some linear order, and the ranking tells the index of a given member.
By "fast" I mean clearly faster than iterating the distributions in a linear order until a match is found. Let's say a "fast" unranking takes time , where is a constant, . The naive iteration takes time when accessing the last element ().
Some observations and related problems
-
The counting problem is well understood: can be efficiently calculated using the cycle index theorem, a.k.a. Pólya counting (see e.g. this blog post)
-
The iterating problem is also well understood: there are nice algorithms for going through in some linear order, see e.g. Borie (2013). This algorithm is implemented in SageMath, class IntegerVectorsModPermutationGroup.
-
For some groups the ranking and unranking are well understood.
-
If is trivial, then we have simply the ranking/unranking problem of nonnegative integer vectors having a fixed sum, and its solutions are well known.
-
If , then the ball distributions are partitions of the integer . The answers to MO question "Computing the lexicographic indices of integer partition" describe a general unranking method that seems applicable: basically, consider values for , and solve the counting problem for the remaining boxes with the remaining balls; then compare the count to your index, and either increment , or fix it and solve the remaining boxes recursively.
However, even in some relatively simple special cases, like containing swaps of some boxes (and fixing some other boxes), or the boxes arranged as a necklace (cyclic permutations) or a bracelet (cyclic permutations + reflection), I could not find a known algorithm. In special cases one can of course cook up a solution, but I'm wondering if the general case is solved somewhere. I would also like to hear of any interesting special cases that have been already solved, perhaps even implemented somewhere.
As mentioned, SageMath's IntegerVectorsModPermutationGroup is good for iterating; but it has simply the "default" rank and unrank functions that iterate until match. In fact even its cardinality function works by iterating: if we have boxes with no symmetry ( is trivial), and balls, it takes something like 20 seconds to calculate . (Of course, by stars and bars, it is .)
My motivation for the question is that this is needed as a subroutine in my work with some classes of graphs (basically, I would like to find the th way of adding some indistinguishable vertices at some locations in the graph, where the symmetry of the graph makes some solutions equivalent).
Update (2.1.2024): While wading through literature, I found the following opinion by Kopparty, Kumar and Saks 2016 (boldface mine):
However, it seems that not all combinatorial counting arguments lead to efficient indexing algorithms. A prime example of this situation is when we have a finite group acting on a finite set, and the set we want to index is the set of orbits of the action. The associated counting problem can be solved using the Burnside counting lemma, and there seems to be no general way to use this to get an efficient indexing algorithm.
This somewhat dims my hopes of finding an existing efficient algorithm for the general case. Hence I would be interested even in solved special cases. (Kopparty et al. discuss the unranking of necklaces, which have circular symmetry.)
References
Borie, Nicolas, Generation modulo the action of a permutation group, Proceedings of the 25th international conference on formal power series and algebraic combinatorics, FPSAC 2013, Paris, France, June 24–28, 2013. Nancy: The Association. Discrete Mathematics & Theoretical Computer Science (DMTCS). Discrete Mathematics and Theoretical Computer Science. Proceedings, 767-778, electronic only (2013). ZBL1294.05183.
Kopparty, Swastik; Kumar, Mrinal; Saks, Michael, Efficient indexing of necklaces and irreducible polynomials over finite fields, Theory Comput. 12, Paper No. 7, 27 p. (2016). ZBL1373.11080.
Statement and context adapted from MathOverflow · Jukka Kohonen
CC BY-SA 4.0 · Formatting adapted; mathematical formulas preserved · Source history
A few useful definitions
- Cardinal and countability
- A cardinal measures the size of a set. A countably infinite set can be listed using the positive integers; an uncountable set is larger. The symbols ℵ₀, ℵ₁, … distinguish infinite sizes.
- Prime number
- An integer greater than 1 whose only positive divisors are 1 and itself. Examples include 2, 3, 5 and 7.
- Graph
- A set of vertices connected by edges. A vertex’s degree counts the incident edges; the statement specifies whether directions or multiple edges are allowed.
- Group / abelian group
- A set with an associative operation, an identity and an inverse for each element. It is abelian when swapping the order of two elements does not change their product.
Sources and original status
- MathOverflow Status in source : unanswered at collection
Last activity on the question :
Coverage, sources and method
This count measures imported entries, including distinct variants. It is not a count of all open mathematical questions worldwide. One entry may belong to several fields and sources.
This directory is neither exhaustive nor updated in real time. “Reported open” describes the source classification observed at import; imported entries have not each undergone independent mathematical verification. The 32 explained entries were reviewed separately.
Formal Conjectures: only “research open” statements with no reported formal proof are retained; their tag is checked in a pinned repository revision. Variants remain distinct. A “sorry” placeholder is not sufficient to establish open status.
Erdős: solved or independent problems and entries with a Lean solution are excluded, including “open (Lean)”. Exact matches to the main Formal Conjectures statements are merged.
Open Problem Garden: the open index is checked against the solved index; spam, identified clones and some outdated statuses are excluded. Statements and definition context are attributed to their original pages; formulas are preserved and the content remains under the GFDL. Recognized duplicates across sources are merged; this does not resolve every mathematical equivalence.
OEIS: direct extraction of conjectural comments and formulas, one entry per sequence, excluding mentioned resolutions. MathOverflow and Math Stack Exchange: questions classified as unanswered by their API, excluding closed posts and non-research categories. They remain distinct from problems reported open. This is a partial, dated collection; every entry credits its authors and license.
Documented exclusions account for recent announcements and conflicting statuses. A stronger variant or a special case can remain open after a different statement is settled.
Attribution: The Formal Conjectures Authors; teorth/erdosproblems and contributors; Open Problem Garden and contributors. Each source retains its license.
- Formal Conjectures · 1,924 · Apache-2.0 / CC-BY-4.0
- Erdős Problems (teorth) · 622 · Apache-2.0
- Open Problem Garden · 404 · GFDL (source content); only title/category/link metadata imported
- OEIS · 18,857 · CC BY-SA 4.0
- MathOverflow · 19,035 · CC BY-SA (version on each entry)
- Mathematics Stack Exchange · 35 · CC BY-SA (version on each entry)