# Questions tagged [combinatorics]

Questions on the use of Mathematica in combinatorics, including the Combinatorica add-on package.

380 questions
Filter by
Sorted by
Tagged with
261 views

### Rewriting partitions using exponents

I'm looking for a way to re-express a partition given in full form, like $\{{2, 2, 1, 1}\}$, into the shortened form $\{2^2, 1^2\}$, i.e. given a partition with repeated entries, count the number of ...
8 views

### help with proving combinatorial identity [migrated]

seems hard to prove the next identity. i think the direction is through combinatorics reasons. thanks.
802 views

### Sierpinski carpet with GraphData

Is this graph in the list among the so-called "standard" structures used in GraphData? However, I have not found yet anything like "Carpet" or "Sponge" in the list ...
86 views

### How to calculate and display circuits, closed paths, simple paths, cycles … of edges (with a specific length)

I'd like to know that how can I find circuit(basic), simple path, closed path of these edges: Example: ...
150 views

### Permutations with Repetition Symbol

I am trying to compute this formula in Mathematica: $$a = \sum_{n=0}^A P_A^{A-n,n}$$ Where A can be any positive number The problem is that I am unable to find the symbol for permutations with ...
62 views

### Visualization and setting up the Kneser graph of the number of combinations “a from n by k” in Mathematica

I need to visualize the combination "a from n to k" using a graph $KG_{n,k}$ and depict the following: As we know, the graph structure is determined by the number of vertices and the connection ...
304 views

### How to solve this problem 710 of Project-Euler

I want to solve this problem: The number 6 can be written as a palindromic sum in exactly eight different ways: (1,1,1,1,1,1),(1,1,2,1,1),(1,2,2,1),(1,4,1),(2,1,1,2),(2,2,2),(3,3),(6) We ...
37 views

### Find all pairs of disjoint subsets of list

Given a set $E$, how can I find all pairs of subsets $E_1, E_2$ which are non empty and disjoint? I don't care the order of $E_1, E_2$. Right now I use a bit complicated code. First find all ...
128 views

### Counting the number of binary strings of length m with no consecutive 1s (RR). How to improve it?

I am new to Mathematica and I am trying to solve this problem of counting the number of binary strings of a certain length m, as far as no consecutive 1s are there. For instance m = 3, my recurrence ...
151 views

### All combinations assuming independence

This may be a basic question. Given an array of probabilities of length $n$, trying to create a vector of all $2^n$ combinations assuming independence between them, where either $p_i$ or $1-p_i$ is ...
68 views

### How to find maximal determinant of a 5×5 or 6×6 matrix using the integers 1 to $n^2$ quickly

This code can only solve the 3 * 3 matrix: ...
76 views

### How to speed up the calculation of the number of $4 \times 4$ Young tableaux

I find the problem of calculating $n \times n$ Young tableaux from here. I can get the number of $3\times 3$ Young tableaux by violent enumeration is $42$： ...
186 views

### Combinations to crack code

I have a set of numbers from 0 to 9 numbers=Range[0,9,1] I want to determine the combination of three numbers between 0 and 9. There is a correct combination ...
2k views

### All possible topological orderings of a graph

TopologicalSort[] returns one of many unique orderings. From wikipedia: if a topological sort does not form a Hamiltonian path, the DAG will have two or ...
79 views

### every set intersection for every set in a family with another family of sets

I want to find for each list within a list of lists what intersections occur when taking set intersection for each list in another list of lists. Hopefully that makes sense. I have tried ...
580 views

### Generate only unique combinations when input contains duplicates

I have a list with repeated elements, such as list = {a, a, b, c, c, c} and I'd like a list of the unique ways to choose 3 elements from it: ...
230 views

### Testing for Symmetry and Regularity in (Graph-Theoretic) Graphs

I know my way around Mathematica pretty well, however I have not been able to find any built-in functionality for testing a (graph-theoretic) graph for being symmetric (arc transitive) – this is the ...
60 views

### Generate all spanning trees of the complete graph

How can you use Mathematica to generate all the spanning trees of the complete graph? One can count the spanning trees of a connected graph ${G}$ using e.g. the Tutte polynomial $T_{G}(1,1)$. For the ...
45 views

### Add Edge Label to certain edge in a bipartite graph

From https://mathematica.stackexchange.com/a/109436/70384 , I modified the code to display the bipartite graph I want and how do I label my edge with the edge weight by manually specifying it? I use <...
82 views

### How can I make a list of 3-connected graphs with 100 points

I'm trying to make the list of all 2-connected subcubic graphs with at most N vertices. I tried this code: ...
53 views

### Permutations and Combinations of Binary Values

I am working on optimization of multipole magnets. Reduction of the number of possible configurations of the magnets essentially becomes the unique determination of the minimum value for all possible ...
43 views

### Generate a list of the product of combinated terms in groups of 2

Here is what I have: j1=2 Do[Print[w[m1, n1] = ToExpression["w" <> ToString[m1] <> ToString[n1]]], {m1, 1, j1}, {n1, 1, j1}] That's what I got:...
274 views

### How to use Mathematica to solve this problem of planting tree

To plant trees at the center of each small square in a 3 * 4 rectangular area, it is required that there should be no continuous number of three (or more) trees in three directions of Horizontal, ...
83 views

### Manage to save large arrays

Some time ago I asked the following question: Merge list repeating elements I was easily answered and I was satisfied by the answer. However in computing such combinatorics, I saturated the RAM very ...
137 views

### Merge list repeating elements

Suppose I have a list with mixed elements {{{a,b},{c,d}},{{e,f},{h,i}}} Is there a way so that I can reshuffle the elements to get the following? ...
752 views

### All possible combinations of ways to write an equation

I want to define a function in Mathematica where I get all combinations of an expression, e.g., input: {q,p1,p2} Output: ...
32 views

### Evaluation control in constructing table iterators

I'm trying to set up a table to scan over combinatorially many sets of numbers. I want to have all choices of $({}^n C_k)\cdot({}^n C_{k}-1)\cdot\ \cdots\ \cdot ({}^n C_{k}-m)$, where I keep ...
111 views

### Enumerating all orientations of an undirected graph

Given an undirected graph $G$, an orientation of $G$ is a directed graph obtained by assigning every edge a direction, a superorientation of $G$ is a directed graph obtained by orienting every edge in ...
190 views

### What does GraphData[“Cubic”, n] do?

I don't have Mathematica, yet, but I just wanted to know what the output of the following was: GraphData["Cubic", 20] I'm trying to understand how many unique not-...
141 views

### how to efficiently generate all directed graphs with 6 vertices

I am attempting to generate all non-isomorphic directed graphs with 6 vertices using command ListGraphs[6, Directed].But it does not work efficiently and takes a ...
64 views

### Delete duplicates when cycle both position and element

Cycle of position means: {a, b, a, a} and {a, a, b, a} is the same. Cycle of element means: ...
146 views

### Enumerating $4 \times 4$ matrices satisfying parity constraints

I've encountered a problem, which requires computer aid, but it seems a little above my Mathematica prowess because it requires counting objects satisfying some simple conditions. It seems doable, ...
84 views

### Building matrices of 0’s and 1’s

How would I go about computing the number of ways an nxn matrix of 1’s and 0’s can be made such that every nxm submatrix has more rows containing 1’s than the number of columns m?
98 views

### How to set a custom number field to solve this equation

x1 , x2 , x3 , x4 and x5 can only be taken from {-1,1,2,4}. How to set a custom number field to solve this equation. ...
378 views

### How can I get all 4 × 4 submatrices of an n × n matrix?

I have a square matrix, I need to extract all possible combinations of 4 × 4 submatrices, where $n > 4$. For example in the case of a 6 × 6 matrix, there are 15 4 × 4 submatrices. I need the list ...