# Rearrange a dense distance matrix to a 2x2 non-perfect block diagonal form

I have a distance matrix (square, symmetrical, non-negative, dense). I want to split the objects into two well-connected groups. Mathematically speaking, I want to group (re-arrange) the rows/columns so that when the matrix is viewed as a 2x2 block-diagonal matrix, the diagonal blocks are "close to zero".

Again: Given an square matrix $M$ of size $N$ I want to find a rearranged matrix $M'$ and a division point $k: 1 < k < N$ such that $norm(M_{1..k,1..k})$ and $norm(M_{k+1..N,k+1..N})$ are minimized (where $norm$ is sum, max, sum of squares or some other norm).

P.S. My ultimate goal is to extract a hierarchy of well-connected components from a complete graph.