Implemented is_connected method in Graph class.