Implement connectivity check

* Use DFS to check connectivity
* Reuse generic search algorithm to traverse the Graph