Terminology for algorithms detecting islands in a boolean (true or false) matrix

94 Views Asked by At

There is a boolean matrix with elements of either true or false:

Matrix

It's intended to figure out if there are any islands (with a size threshold) in the matrix. For the above example:

  • The right green region is island
    • It's not connected to matrix border
    • Its area is smaller than a threshold
  • The left green region is not an island
    • Its area is larger than the threshold

I wonder what is the name of such mathematical algorithms, if they exist. What's terminology? I would like to search the terminology, find available options, and pick one algorithm to go ahead with.

1

There are 1 best solutions below

0
On

This problem can be solved with graphs. Your islands are connected graphs and the cells are nodes. If your islands need a minimum area you could add an additional criterion for the subgraphs by only accepting subgraphs with more than $k$ nodes. The other condition with touching the border can also be easily incorporated by checking if any node lies on the boundary. There are multiple open source libraries (e.g. networkx for python) for detecting connected subgraphs.