adrian0010 / Percolation

1 stars 0 forks source link

[Statistics] Number of Channles & Percolating Channels #4

Closed discoleo closed 1 year ago

discoleo commented 1 year ago

Statistics: Number of Channles

All clusters start on the 1st column of the matrix. You can get the number of these by counting the unique ids on this column:

nClusters = unique(r[ , 1]); nClusters = nClusters[nClusters > 0];

All percolating clusters end on the last column of the matrix:

last = ncol(r); # basically the width of the matrix; nClustersP = unique(r[ , last]); nClustersP = nClustersP[nClustersP > 0];

Clusters that communicate with the right-side, but do NOT percolate: can be computed by applying flood.all on the "reverted" matrix:

rm = rev(r); id.start = max(nCluster) + 1; r = fllod.all(rm, id.start=id.start); nClusterL = unique(r[, 1]); nClustersL = nClustersL[nClustersL > 0]; nClusterLOnly = nClusterL - nClusterP; # Optional: revert the matrix back & save as r; r = rev(rm);

Note: