Added connectivity algorithms

Some additional stuff from Lau; just need to modify it to work more
elegantly with our specific architecture.