connects if they are not already connected, and if none of the intermed config are self-colliding.
connects if they are not already connected, and if none of the intermed config are self-colliding.returns number of connections established. the intermed config energies are returned in energies vector. this vector includes the start and end configs.