Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Finding clusters (bwlabel in matlab)?' topicStudent Support Forum > General > "Finding clusters (bwlabel in matlab)?"

Next Comment >Help | Reply To Topic
Author Comment/Response
Quantumboredom
03/16/10 10:04am

Hi. We will soon be studying percolation in a course I'm taking, and the lecturer has tipped us that we will have to have a way of finding clusters in a dataset. From what I understand we will be randomly populating a matrix (or something equivalent, like a integer-only coordinate system), and we want to find clusters in this dataset. For example:

1 0 0 1
1 0 1 1
0 1 0 0
0 0 1 1

has 4 clusters, if they are labeled with different numbers:

1 0 0 2
1 0 2 2
0 3 0 0
0 0 4 4

It seems what we need is to be able to generate such a system randomly (I can figure out how to do that), and then gather statistics (how large is the largest group, what's it's area etc). We also want to create an image where each group would have it's own colour.

The lecturer uses Matlab, and the function bwlabel seems to do all of these things. Is there something similar in Mathematica 7.0? I've been trying to get FindClusters to do this, but I haven't had much success. If I generate a list of coordinates FindClusters sort of works, but I can't get it to only recognize directly linked points. In other words I need it to somehow always treat something like this:

1 1 0 1
1 1 0 1
1 1 1 1
0 0 0 0

as one group, while this:

1 1 0 1
1 1 0 1
1 1 0 1
0 0 1 0

is three groups.

Anyone know how to do this? It seems like FindClusters should be able to, but it looks like it was designed for much more complex rules of determining what is a cluster than what i want.

Thanks for any help :)

URL: ,

Subject (listing for 'Finding clusters (bwlabel in matlab)?')
Author Date Posted
Finding clusters (bwlabel in matlab)? Quantumboredom 03/16/10 10:04am
Re: Finding clusters (bwlabel in matlab)? yehuda ben-s... 03/17/10 10:44am
Re: Re: Finding clusters (bwlabel in matlab)? Quantumboredom 03/21/10 11:01am
Re: Finding clusters (bwlabel in matlab)? yehuda ben-s... 03/22/10 05:09am
Re: Re: Finding clusters (bwlabel in matlab)? Quantumboredom 03/22/10 06:45am
Re: Re: Re: Finding clusters (bwlabel in matlab)? ommar 11/14/10 5:15pm
Next Comment >Help | Reply To Topic