I'm working in matlab, and looking for help on how to do the following. (answers in any language or pseudocode will be fine)(adsbygoogle = window.adsbygoogle || []).push({});

I have an nxn matrix, with each cell containing a 1 or a 0. The border cells are all 1's.

Is there an efficient algorithm to determine if there are any "islands" of 1's? That is, any 1's not connected to the border.

For example, if my matrix is:

1 1 1 1 1 1

1 0 0 0 1 1

1 0 1 0 0 1

1 0 1 1 0 1

1 0 0 0 0 1

1 1 1 1 1 1

I'd like to be able to identify the island of the three 1's (and eliminate them).

Thanks!

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Finding islands in a grid? traversing a graph to find smaller disjoint set

Loading...

Similar Threads for Finding islands grid |
---|

Large Joins in Large Databases -- How to find Keys? |

Can't find my Localhost Database Engine for SQL Server |

C/++/# Finding duplicates algorithm |

**Physics Forums - The Fusion of Science and Community**