# Questions tagged [partitions]

this tag is used for questions regarding splitting a list into sublists

102 questions
Filter by
Sorted by
Tagged with
1answer
40 views

### Moving map with non-overlapping window

How can I apply a function to a list with non-overlapping window. E.g. $data = \{x_1, x_2, ...., x_n\}$ and we apply f with window size 2 to get $\{f(x_1,x_2), f(x_3, x_4), ...., f(x_{n-1}. x_n)\}$. ...
1answer
57 views

### Generating integer partitions with fixed first element

I'm trying to generate all integer partitions where the first entry is a fixed number i.e. all young diagrams with first row/column fixed. I'm aware of the function IntegerPartitions[n] and I could ...
2answers
100 views

### Partitioning values in a sequence

I have a sequence that forms visible lines when plotted as a graph, what would be a good way to automatically partition the sequence to create a list of sequences, one for each line that is visible ...
1answer
523 views

3answers
151 views

### How to Partition rest rows by the first row?

Given a list lst = {{{"1","2","3"},{"4","5"},{"6","7","8","9"}}, { "A","B","C","D","E","F","G","H","I"}, { "9","8","7","6","5","4","3","2","1"}}; ...
5answers
309 views

### How to do a list partition with offset, overhang, and cyclical padding? [closed]

I have a list as {1,2,3,4,5,6,7,8,9} I want to extract a new list as ...
1answer
50 views

### How to find efficiently the independent vertex sets from a large adjacency matrix?

I have a binary adjacency matrix $M$ of size $72\times 72$. I would like to find all possible combinations of 18 non-adjacent nodes. There are $^{72}C_{18}$ possible (adjacent and non-adjacenct) ...
2answers
351 views

### How to color nodes in a adjacency graph with different colors?

Let us consider a binary adjacency matrix $M$. We want to color the nodes of corresponding adjacency graph with 4 different colors such that two adjacent nodes have different colors. How to find 4 ...
2answers
139 views

### Partitioning sublists based on positions, with new partitions immediately following original sublist

I need to restructure this list nums: ...
0answers
38 views

### How to form sets of non-adjacent subgraphs from all possible subgraphs and the adjacency matrix?

I have connected graph with $72$ nodes. The binary adjacency matrix of the connected graph is $A$. The size of $A$ is $72\times 72$ and its symmetric. I have generated all possible subgraphs ($17000$...
2answers
213 views

### Partitioning a set of integers

I have a set of ordered integers, e.g. {1,2,3,6,7,9,10} and I would like to partition the set in subsets of sequential numbers, e.g. ...
2answers
67 views

### Partitioning Mixture Distribution Dataset into constituent Distributions

Suppose I have a dataset that is derived from a random sampling from a mixture distribution ...
0answers
30 views

### Partition data but dropping elements between each sublist

Is there a neat way to partition a list into sublists of fixed length $n$, discarding a fixed number $k$ elements between each one? E.g for $n=3, k=1$, ...
0answers
47 views

### In what order does Combinatorica's SetPartitions function list the partitions of a set?

For example, Needs["Combinatorica"] n = 4; partitions = SetPartitions[Range[n]]; Table[Print[partitions[[i]]], {i, 1, BellB[n]}] generates ...
0answers
30 views

### Enumerate all lists of $m$ non-negative integers that add to $n$ [duplicate]

Let $x_1,\dots,x_m$ be non-negative integers such that $\sum_{i=1}^m x_i=n$, where $m,n$ are given. How can I enumerate all such lists of $m$ integers that add to $n$? Note that ...
2answers
58 views

### Groupings of the Elements of a List with at Most $k$ Elements

Given a list with $n$ elements and an integer $k$ I want to get a list with all possible groupings of these n elements in sets with at most k elements. For example, given $n=\{1,2,3,4\}$ and $k=3$ I ...
2answers
266 views

Writing: ...
1answer
348 views

### How to split list into segments based on first element of sublist, and remove ineligible segments

I have a list that looks like this: ...
1answer
37 views

### Find vertices of a hypercube given a set of partitions

Problem The goal is to take a set of $n$ linear partitions $\left\{p_{k}\right\}_{k=1}^{n}$ and create a hypercubic partition: $$\mathbf{P}=p_{1}\times p_{2}\times \cdots\times p_{n}$$ Each ...
2answers
119 views

### Totally orderless partition

This is a slight variation of: How to generate all possible orderless partitions of a list according to another list? Consider each set following a partition a "box" and each element a "ball". What ...
1answer
187 views

1answer
60 views

### Partition lists into sub-lists based on whether they are consecutive or not [duplicate]

I am new to Mathematica and would appreciate any help. I'd like to partition my data which is comprised of {time x analog input} into sublists of consecutive time. In other words, my data looks like ...
3answers
111 views

### How to get the N Mth (e.g. 1st 4th, 5th 8th etc of) a dataset?

With all the tools and commands for segmenting lists, I'm having a hard time finding something to do the following: I want to programmatically subset the Nth Mth of a list. This could be the 1st 4th, ...
1answer
76 views

### Non-trivial partitions of numbers using Combinatorica

I have made a code which gives back partitions of numbers in two Young diagrams (one Young diagram is trivial). For example, the partitions of 1 are ...
6answers
638 views

### How to generate all possible orderless partitions of a list according to another list?

This question is hard to describe in plain text. So I will post an example and a working code (brute force) to illustrate. For example I have a list: ...
3answers
145 views

### Variable iterator in Do Loop (splitting a list)

I have a list in Mathematica that looks like the following: {{92,3},{23,3},{93,3},{63,2},{66,2},{24,4},{94,4},{27,4},{72,4},....} The point is that the second ...