PREREQUISITE : DFS EXPLANATION LINK : https://cp-algorithms.com/graph/search-for-connected-components.html