  We generalize the Fortuin-Kasteleyn (FK) cluster representation of the
partition function of the Ising model to represent the partition function of
quantum spin models with an arbitrary spin magnitude in arbitrary dimensions.
This generalized representation enables us to develop a new cluster algorithm
for the simulation of quantum spin systems by the worldline Monte Carlo method.
Because the Swendsen-Wang algorithm is based on the FK representation, the new
cluster algorithm naturally includes it as a special case. As well as the
general description of the new representation, we present an illustration of
our new algorithm for some special interesting cases: the Ising model, the
antiferromagnetic Heisenberg model with $S=1$, and a general Heisenberg model.
The new algorithm is applicable to models with any range of the exchange
interaction, any lattice geometry, and any dimensions.
