How to Organize Binary Attribute Matrix into Diagonal Form

Hi all,

I have a large (about 400 rows by columns) binary attribute matrix, where the elements are one if there is a connection between the corresponding row and column element, and zero if not. Currently I am having trouble visualizing the matrix. Displaying the matrix in a heatmap fashion or directly printing the matrix will both be unreadable due to the size of the matrix.

As a result, my idea is to reorganize the matrix (reorder the rows and columns) so that most of the ones are along the diagonal, allowing me to divide up the large matrix into block components (along the diagonal) and visualize separately. Therefore, I am curious whether such implementation has already been attempted before? Even better, I would really appreciate if someone could offer alternative visualization options for plotting a large matrix in heatmap form. Thanks a lot!