How can i make a program in python that calculates the number of isolated clusters of two connected '1' in a matrix containing only ones and zeroes?
I tried to verify the neighbors of each 1 but then it counts a cluster multiple times. Is there any way to do it without checking the neighbors at all?