| 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: , |
|