Bug fix: Corrected computation of connected components in c++