Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Building clusters out of a nested list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114972] Re: Building clusters out of a nested list
  • From: Roland Franzius <roland.franzius at uos.de>
  • Date: Fri, 24 Dec 2010 04:14:30 -0500 (EST)
  • References: <iev2sj$4uf$1@smc.vnet.net>

Am 23.12.2010 09:56, schrieb Dmitry:
>   { {A,B,C},{C,D},{E,F},{F,H}}


Repeat replacing two sublists with at least on common element by their 
common Union

In:
{{A, B, C}, {C, D}, {E, F}, {F, H}} //.
  {X___List, {x1___, a_, y1___}, Y___List, {x2___, a_, y2___},
    Z___} :>
	{X, Y, Z, Union[{x1, a, y1}, {x2, a, y2}]}


{{A, B, C, D}, {E, F, H}}

-- 

Roland Franzius


  • Prev by Date: Re: ODBC-connection
  • Next by Date: Re: Building clusters out of a nested list
  • Previous by thread: Building clusters out of a nested list
  • Next by thread: Re: Building clusters out of a nested list