Implement graph connectivity check