Add simple connection decision

Using BFS to test whether the graph is connected