how to tell if a graph is connected or disconnected