Implementation of connected components from PPL 2010 paper