MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Find combinations in k-subsets


I would like to solve the following problem:

Having k-subsets given in lexicographic order as input:
 
{1,2,3},{1,2,4},{1,2,5},{1,2,6},{1,3,4},{1,3,5},{1,3,6},{1,4,6},
{2,3,4},{2,3,6},{2,4,6},{3,4,6}

I would like to determine the possible combinations.

In this case the k-subsets:

{1,2,3},{1,2,4},{1,2,6},{1,3,4},{1,3,6},{1,4,6},{2,3,4},
{2,3,6},{2,4,6},{3,4,6}

correspond to the combination:  [{1, 2, 3, 4, 6}, 3] 

and there are  two remaining k-subsets: {1,2,5} and {1,3,5}

This is more or less the opposite of the function KSubsets[ ].

Is there any function to do this? 
Can you think of an efficient algorithm? 

Thank you for your help

-:- Carlos



  • Prev by Date: Plotting (x,y,z) style data
  • Next by Date: Re: Cut and paste edits mis...
  • Previous by thread: Re: Bad error messages
  • Next by thread: Re: Find combinations in k-subsets