finds connected components and paint it
finds connected components and paint it