Re: Finding Clusters

*To*: mathgroup at smc.vnet.net*Subject*: [mg104717] Re: Finding Clusters*From*: Leonid Shifrin <lshifr at gmail.com>*Date*: Sat, 7 Nov 2009 06:51:44 -0500 (EST)

A follow-up to my previous post - in the comparison code that I posted one must set the parameter <a> to some value (0.7 or some other) In[1]:= a=0.7; before running anything else, for it to work. Regards, Leonid On Fri, Nov 6, 2009 at 1:17 PM, Fred Simons <f.h.simons at tue.nl> wrote: > I feel I have to remark that with respect to me there is nothing > brilliant in the solution I posted. The idea behind it was the result of > a discussion in this group, many, many years ago, on a similar problem. > But anyway, it is a very beautiful result! > > The real brilliant thing is the improvement that was given by Szabolcs > Horvat in [mg104644]. > > Fred > > > DrMajorBob wrote: > > Brilliant as usual, Fred. > > > > I did think intervals only needed to overlap to "correspond", whereas > your > > solution requires them to share an end-point. > > > > For instance, in this example the first interval is a subset of the > second > > interval and overlaps with the third, yet "components' associates it with > > neither. > > > > event = {{1, 2} + 1/2, {1, 3}, {3, 4}, {5, 6}, {7, 8}, {8, 10}}; > > components@event > > > > {{1, 3, 4}, {3/2, 5/2}, {5, 6}, {7, 8, 10}} > > > > I can't really guess the OP's intent. > > > > Bobby > > > > On Wed, 04 Nov 2009 00:33:25 -0600, Fred Simons <f.h.simons at tue.nl> > wrote: > > > > > >> Here is a very short, very fast but not very simple solution: > >> > >> components[lst_List] := Module[{f}, > >> Do[Set @@ f /@ pair, {pair, lst}]; GatherBy[Union @@ lst, f]] > >> > >> Fred Simons > >> Eindhoven University of Technology > >> > >>> All. > >>> > >>> I have a list which represents some natural event. These events are > >>> listed pair-wise, which corresponds to event happening within certain > >>> time interval from each other, as below > >>> > >>> event={{1,2},{1,3},{3,4},{5,6},{7,8},{8,10}} > >>> > >>> I wish to find a thread of events, i.e. if event A is related to B and > >>> B to C, I wish to group {A,B,C} together. For the example above I > >>> would have > >>> > >>> {{1,2,3,4},{5,6},{7,8,10}} > >>> > >>> This would correspond to do a Graph Plot and identifying the parts > >>> which are disconnected It should be simple but I'm really finding it > >>> troublesome. > >>> > >>> > >>> > >>> > > > > > > > > >