prevent disconnected graph