Questions tagged [subset]
Questions on the usage of the Subsets command and related functionalities (Tuples, Permutations etc.), and on how to implement more efficient algorithms.
76 questions
0 votes
2 answers
124 views
Generate particular groupings
I think I found the way I want: ...
2 votes
1 answer
126 views
Find a cyclic vertex-cut with fixed size
Let $G$ be a graph. A vertex subset $F \subset V(G)$ is a cyclic vertex-cut of $G$ if $G-F$ has at least two components containing cycles. I plan to write a test to check if a graph $G$ contains a ...
8 votes
2 answers
258 views
Largest subsequence of digits that form a prime?
Question Given a list of digits 0-9 {d[[1]],d[[2]],...,d[[n]]}, I am interested in finding the largest subsequence of digits (largest when you ...
2 votes
2 answers
132 views
Subsets command not working as expected with dot product of matrices
My understanding is that Subsets[Dot[a,b],{1,2}] gives the output ${a, b, a.b }$ But for some reason, this does not work when I try to do it with matrices. ...
3 votes
3 answers
261 views
How to retrieve the index of a subset in Subsets[list,nspec,{s}]?
Subsets[Range[2000], {4}, {n}] would give the $s^{th}$ subset of the Subsets[Range[2000], {4}]. For example, ...
2 votes
1 answer
117 views
Find disjoint subsets and their union is {1...9}
I have such a list sets = Select[IntegerDigits /@ (Range[Floor@Sqrt@987654321]^2), DuplicateFreeQ@# && FreeQ[#, 0] &] I want to pick all subsets of ...
2 votes
1 answer
85 views
How to quickly join in the following way? [duplicate]
Consider the following table: tab = RandomReal[{0, 1}, {10, 3}]; subsets=Subsets[tab, {2}]; How to quickly reduce subsets to a ...
6 votes
3 answers
299 views
How to quickly join in the following way?
Consider the following table: tab = RandomReal[{0, 1}, {10, 3}]; subsets=Subsets[tab, {2}]; How to quickly reduce subsets to a ...
2 votes
3 answers
176 views
I'm tired trying to get subsets
t={{a,b},{},{},{},{a},{a,b},{},{a,b,c},{},{b}} s={{},{a,b,c},{a,b}} Thread[Subset[t,s]] I'm tired of trying to calculate: {a,b} [which is the intersection [{a,b}, {...
0 votes
1 answer
129 views
Generating a list of unions from subsets
I have ...
0 votes
1 answer
165 views
Generating the union of possible subsets
I want to calculate the union of possible subsets within each set of the family of sets. I use the following code: ...
6 votes
7 answers
563 views
Count all co-occurances of a pair of strings in a list of lists
I am trying to obtain a co-occurance matrix for pairs of names in a collection of groups of names. So, I have a collection of letters in small groups, such as ...
2 votes
3 answers
344 views
How can I optimise the creation of subsets?
I have a list of 21 elements from which I have obtained possible combinations of minimum 3 and up to 10 elements using the Subsets function as follows: ...
4 votes
3 answers
214 views
How to make two sub-sets each with two distinct elements having a list with four elements?
Consider the following list: list = {{meson1, p1}, {meson2, p2}, {meson3, p3}, {meson4, p4}} I would like to organize it into two sub-sets, each with two elements, ...
10 votes
5 answers
1k views
Find the farthest pairs of two points in 2-dim
I wonder if Mathematica can find the pairs of two points that are the farthest in a given list. Let's say a list, XYlist, of points with (x,y) coordinates. ...