  The stochastic block model (SBM) is a generalization of the
Erd\H{o}s--R\'enyi model of random graphs that describes the interaction of a
finite number of distinct communities. In sparse Erd\H{o}s--R\'enyi graphs, it
is known that a linear-time algorithm of Karp and Sipser achieves near-optimal
matching sizes asymptotically almost surely, giving a law-of-large numbers for
the matching sizes of such graphs in terms of solutions to an ODE. We provide
an extension of this analysis, identifying broad ranges of stochastic block
model parameters for which the Karp--Sipser algorithm achieves near-optimal
matching sizes, but demonstrating that it cannot perform optimally on general
SBM instances.
  We also consider the problem of constructing a matching online, in which the
vertices of one half of a bipartite stochastic block model arrive
one-at-a-time, and must be matched as they arrive. We show that the competitive
ratio lower bound of 0.837 found by Mastin and Jaillet for the
Erd\H{o}s--R\'enyi case is tight whenever the expected degrees in all
communities are equal. We propose several linear-time algorithms for online
matching in the general stochastic block model, but prove that despite very
good experimental performance, none of these achieve online asymptotic
optimality.
