Precompute VertexPartition.size.