Let $M$ be a matrix of $n$ rows and $m$ columns having values only $0$ or $1$. $M$ is said to be rearrangeable if you can swap (interchange) some columns or some rows with each other in a way such that all the primary diagonal elements are $1$. I know this can be solved using bipartite matching but I am unable to visualize its solution.
Link to original problem - Link
Link to a solution - Problem 6 of this PDF
I am interested to know why we can model this problem as a bipartite matching problem. Since here we can swap two rows and two columns so how can that swap operation(interchange operation) be represented as edges in the graphs and why maximum matching of a certain value guarantees that there exists an answer.