Pregunta de entrevista de Amazon

Design a graph traversal algorithm to count islands