tests whether a matrix is connected from top to bottom via open sites