Partitioning for 1d adjacency matrix