is_connected function

Checks if a graph is connected.