Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Identifying clusters of adjacent points on a lattice

  • To: mathgroup at
  • Subject: [mg81384] Identifying clusters of adjacent points on a lattice
  • From: Gareth Russell <russell at>
  • Date: Fri, 21 Sep 2007 03:10:20 -0400 (EDT)


Is there any way to use the built-in clustering routines to find
clusters of ajacent elements on a 2d lattice? For example, I might
generate a 'map' with

testMap = =E2=80=A8 Last[CellularAutomaton[{1018, {2, {{0, 2, 0}, {2, 1, 2},
{0, 2, 0}}}, {1, =E2=80=A8     1}}, Table[If[Random[Real] < 0.1, 1, 0], {100},
{100}], 10]];

I would then like to find and label the separate 'patches' consisting
of clusters of 1's. Ultimately, I'm looking for a list of {x,y,id}
triples where the x and y are the coordinates of each 1 and the id is a
number that identifies the patch to which that element belongs, but the
trick is to find the clusters. I can't see how any of the included
options for FindClusters would perform this particular test (each
cluster must consist of elements connected to at least one other
element by a distance of 1).

Of perhaps there is another way?


Gareth Russell

  • Prev by Date: Re: Linux V6: slow input
  • Next by Date: Re: DSolving(?) for a given tangent
  • Previous by thread: Re: adding rows to a table of data by looking in the table
  • Next by thread: Re: Identifying clusters of adjacent points on a lattice