Calculate adjacency matrix for some partitions.