MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / count_islands

Method count_islands

matrix/count_islands_in_matrix.py:29–37  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

27 self.diffs(i + row_nbr[k], j + col_nbr[k], visited)
28
29 def count_islands(self) -> int: # And finally, count all islands.
30 visited = [[False for j in range(self.COL)] for i in range(self.ROW)]
31 count = 0
32 for i in range(self.ROW):
33 for j in range(self.COL):
34 if visited[i][j] is False and self.graph[i][j] == 1:
35 self.diffs(i, j, visited)
36 count += 1
37 return count

Callers

nothing calls this directly

Calls 1

diffsMethod · 0.95

Tested by

no test coverage detected