connected component search finished source, untested.