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