  Motivated by persistent homology and topological data analysis, we consider
formal sums on a metric space with a distinguished subset. These formal sums,
which we call persistence diagrams, have a canonical 1-parameter family of
metrics called Wasserstein distances. We study the topological and metric
properties of these spaces. Some of our results are new even in the case of
persistence diagrams on the half-plane. Under mild conditions, no persistence
diagram has a compact neighborhood. If the underlying metric space is
$\sigma$-compact then so is the space of persistence diagrams. However, under
mild conditions, the space of persistence diagrams is not hemicompact and the
space of functions from this space to a topological space is not metrizable.
Spaces of persistence diagrams inherit completeness and separability from the
underlying metric space. Some spaces of persistence diagrams inherit being path
connected, being a length space, and being a geodesic space, but others do not.
We give criteria for a set of persistence diagrams to be totally bounded and
relatively compact. We also study the curvature and dimension of spaces of
persistence diagrams and their embeddability into a Hilbert space. As an
important technical step, which is of independent interest, we give necessary
and sufficient conditions for the existence of optimal matchings of persistence
diagrams.
