Added dfs search algorithm, with connected component calculation