[conn_comp]: Extract connected components code (untested swt)

Extracted conn_comp for use in other projects. conn_comp.m was tested,
but I haven't had a chance to test swt.m right now.