Getting hierarchies of partitions (continue)
- To: mathgroup at smc.vnet.net
- Subject: [mg36488] Getting hierarchies of partitions (continue)
- From: Emilio Martin-Serrano <EMartinSerrano at houston.sns.slb.com>
- Date: Mon, 9 Sep 2002 00:29:25 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Group, Sorry for the previous posting. The following solves (to some extent my problem) <<DiscreteMath`Combinatorica` lPartition[ksN_,r_]:=With[{ks=KSubsets[Range[r],ksN],ks1=Partition[Range[r],1]},MapThread[Complement[Append[#1,#2],(Sequence@@{#}&/@Partition[#2,1])]&,{Array[ks1&,Length[ks]],ks}]] fHierarchy[r_]:=Module[{ksN=2},While [ksN<(r=+1),s=fTaxon[ksN,r];ksN=ksN+1;Print[s]]] fHierarchy[10], gives the structure for 10 elements, and so on. However, I do not like this solution since to my taste is to complex and rather inelegant. Nest or Fold would do better. Any Idea? Just an additional remark. Besides, I do not need the whole taxonomy, but a subset satisfying a minimizing condition on connectivity implied by some relationships among the elements. This condition is satisfied by one and only one element, or class of equivalence in each level of the hierarchy. So it is that very class which matter and consequently the procedure should give control on each class as the total structure is being generated. Once it is know which class satisfy the condition it is possible to avoid generating the whole structure and the subsequent combinatorial explosion. With just fHierarchy[100] a Dell Latitude, 1 GH, 256 MB RAM runs out of memory. Emilio Martin-Serrano