We set out a graphical model for describing probability distributions over
labeled partitions of an undirected graph which are conditioned on
observed data. We show how to efficiently perform exact inference in
these models, by exploiting the structure of the graph and adapting the
sum-product and max-product algorithms. The method can be used for
partitioning and labeling hand-drawn ink fragments, image data, speech
data and natural language data amongst other types of data elements. A
significant performance increase is obtained by labeling and partitioning
simultaneously. It is also possible to partition without labeling.