As far as I understand, you are looking for a family of algorithms that are used to reorder sparse matrices. Usually, it is used to reduce fill-in during sparse factorization; however, it's certainly not the only use.
The first candidate would be (reverse) Cuthill-McKee algorithm. Also, take a look at Matlab sparse matrix reordering page that would demonstrate the work of "column-count" and "minimum degree reorderings". Many others exist. Also, this question on SciComp might be useful. The particular choice of strategy will depend on its intended use and requirements on the reordering phase heaviness.
Notice, that the picture you've shown as an example is produced by sorting the adjacency matrix using additional information about the matrix entries in order to create the block-wise structure. The algorithms I listed use only the matrix itself.