Questions tagged [permutation]
For questions about the functionality related to permutations in Mathematica.
273
questions
4
votes
1
answer
177
views
Fast enumeration of all perfect matchings in complete graph
I have a code that generates the list with all possible Perfect Matchings (PM) of a fully connected graph. Each edge of the graph is mono or bi-colored with up to ...
3
votes
5
answers
830
views
Finding all Latin Squares of order 5
A Latin Square is a square of size n × n containing numbers 1 to n inclusive. Each number occurs once in each row and column.
An example of a 3 × 3 Latin Square is:
$$
\left(
\begin{array}{ccc}
1 &...
0
votes
1
answer
183
views
How to create all possible permutations? [closed]
there is a problem:
I have 5 letters - a,b,c,d,e and 20 places. I have to use each letter at least once but no more than 10 times. So the result can look like {a,a,a,a,a,a,a,a,a,a,b,b,b,b,b,b,b,c,d,e},...
2
votes
1
answer
232
views
How to generate all the combinations with repetition and another conditions? [duplicate]
I want to generate all the combinations with repetition for k variables with values from a set of n elements.
There are some ways, I like this formula, which I found on this forum (it is for n = 2 and ...
2
votes
1
answer
112
views
Splitting balls over sized bins
This is strongly related to Splitting a set of integers over a set of bins, but a much simpler case.
If we have $N$ indistinguishable balls and $k$ arbitrarily large distinguishable bins, we know the ...
6
votes
1
answer
125
views
Splitting a set of integers over a set of bins
I have a problem that feels like it should be simple but I'm just drawing a blank on. I've got a set of integers, e.g.
...
1
vote
1
answer
55
views
Permutation function which allows for repetitions
I want to permute a matrix based on some permutation cycle which is not known beforehand. A function searches through the matrix and returns the pair of indices $i,j$ of the first entry which equals ...
3
votes
1
answer
143
views
Solve this equality of permutations
Is it possible to solve an equality such as:
$$(123)=\sigma (32) \sigma (31)$$
in term of $\sigma$? I was thinking about Cycles but I couldn't figure out a way to ...
4
votes
1
answer
100
views
How to decompose a 5-cycles into a permutationproduct of two 3-cycles?
We know that every 3-cycles can be expressed as the product of two commutations.
Cycles[{{1, 2, 3}}] ==
PermutationProduct[Cycles[{{1, 3}}], Cycles[{{3, 2}}]]
In ...
5
votes
2
answers
72
views
Pair-wise equality over large sets of large vectors
I've got an interesting performance tuning/algorithmic problem that I'm running into in an optimization context.
I've got a set of ~16-50 lists of integers (usually in ...
1
vote
0
answers
75
views
Custom Table, for iterating over permutations
It is common that I iterate over all permutations of 1,2...,n, either by making a table or performing a sum.
Instead of creating the set of all permutations, it would be better to iterate over them.
...
1
vote
1
answer
101
views
How to solve this problem by the way of saving memory?
Eight different boys and five different girls are in a row. Girls are required to be next to each other. How many ways are there (the answer is $9!\times5!$)?
...
3
votes
4
answers
343
views
How to visually display the Stirling permutations of $k^{th}$ order?
Definition of Stirling permutation from Wikipedia:
In combinatorial mathematics, a Stirling permutation of order k is a permutation of the multiset $\{1, 1, 2, 2, ..., k, k\}$ (with two copies of ...
2
votes
4
answers
157
views
How to use function `GeneratingFunction ` to solve this combinatorial problem efficiently?
Divide the 14 elements {A, B, C, C, C, C, D, D, D, D, E, E, E, E} into 7 groups (one group all have two elements), and I want to find out how many kinds of methods ...
1
vote
1
answer
153
views
XOR combination between the bits of a string
Given an integer n, we can construct $2^n$ strings of length n. We can take the first element for each of these strings and create a list. In total 'n' such lists are possible. But now I need to ...