Optimal Vertex Partitions