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?
New contributor
Alex is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.