MathGroup Archive 2009

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

Search the Archive

Re: Finding Clusters


Maybe this is what you want:

intersecting[{a_, b_}, {c_, d_}] := a <= c <= b || c <= b <= d
event = {{1, 2}, {1, 3}, {3, 4}, {5, 6}, {7, 8}, {8, 10}};
Union @@@ Split[event, intersecting]

{{1, 2, 3, 4}, {5, 6}, {7, 8, 10}}

Bobby

On Tue, 03 Nov 2009 01:51:28 -0600, fd <fdimer at gmail.com> wrote:

> 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.
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Problem with mouse EventHandler on linux
  • Next by Date: Re: Finding Clusters
  • Previous by thread: Re: Finding Clusters
  • Next by thread: Re: Finding Clusters