# Minimize The Number of Connected Components in Hit-map of A Boolean Matrix

Suppose there is a matrix with the value of 0 and 1. The hit-map of the matrix (0 is blue and 1 is red) create some connected component (see the following figure as an instance):

Is there any efficient algorithm to minimize the number of connected components (constructed from red cells) by swapping rows and columns of the matrix with this constraint that "As row and column of this matrix comes from the same property set, if we swapping row $$i$$ with row $$j$$, we must swapping the column $$i$$ with column $$j$$ too.".