  One of the most widely used methods for community detection in networks is
the maximization of the quality function known as modularity. Of the many
maximization techniques that have been used in this context, some of the most
conceptually attractive are the spectral methods, which are based on the
eigenvectors of the modularity matrix. Spectral algorithms have, however, been
limited by and large to the division of networks into only two or three
communities, with divisions into more than three being achieved by repeated
two-way division. Here we present a spectral algorithm that can directly divide
a network into any number of communities. The algorithm makes use of a mapping
from modularity maximization to a vector partitioning problem, combined with a
fast heuristic for vector partitioning. We compare the performance of this
spectral algorithm with previous approaches and find it to give superior
results, particularly in cases where community sizes are unbalanced. We also
give demonstrative applications of the algorithm to two real-world networks and
find that it produces results in good agreement with expectations for the
networks studied.
