Contagion Dynamics for Manifold Learning

Contagion maps exploit activation times in threshold contagions to assign vectors in high-dimensional Euclidean space to the nodes of a network. A point cloud that is the image of a contagion map reflects both the structure underlying the network and the spreading behavior of the contagion on it. Intuitively, such a point cloud exhibits features of the network's underlying structure if the contagion spreads along that structure, an observation which suggests contagion maps as a viable manifold-learning technique. We test contagion maps and variants thereof as a manifold-learning tool on a number of different synthetic and real-world data sets, and we compare their performance to that of Isomap, one of the most well-known manifold-learning algorithms. We find that, under certain conditions, contagion maps are able to reliably detect underlying manifold structure in noisy data, while Isomap fails due to noise-induced error. This consolidates contagion maps as a technique for manifold learning. We also demonstrate that processing distance estimates between data points before performing methods to determine geometry, topology and dimensionality of a data set leads to clearer results for both Isomap and contagion maps.


Introduction
Manifold-learning techniques aim to identify low-dimensional manifold structure in high-dimensional data [11]. High-dimensional point-cloud data may represent a large number of features on a collection of objects. Some of these features may be redundant or irrelevant, thus giving the data lower-dimensional intrinsic structure. Alternatively, high-dimensional point-cloud data with low-dimensional intrinsic structure may arise as a sample of points from a low-dimensional manifold that is embedded in a highdimensional space.
Consider, for instance, data points that lie on a plane in three-dimensional space. Principal component analysis (PCA), a classical dimensionality-reduction technique [18], can find the directions along which the data has maximum variance as well as the relative importance of these directions. In the case of the plane embedded in three-dimensional space, PCA returns three vectors: two of positive weight spanning the plane and one vector of zero weight that is orthogonal to the plane. PCA can thus identify the plane underlying the ostensibly three-dimensional data. More generally, consider data points that are concentrated around a low-dimensional manifold (reflecting the underlying information) that is embedded in a high-dimensional space. PCA is a linear dimensionality-reduction method: If the manifold is nonlinear, PCA is unable to detect the low-dimensional space underlying the data set. This is where manifold-learning techniques (as a type of nonlinear dimensionality reduction) can be effective. The purpose of manifold learning is to uncover low-dimensional manifold structure of a data set in a high-dimensional feature space, even if the structure of the data is curved.
A common procedure for nonlinear dimensionality reduction is the following: (1) Create a network on the data points, such as by defining an edge between any two nodes within some distance (producing the -neighbourhood graph) or by connecting each point to its k closest neighbours (producing the k-nearestneighbour graph).
(2) Define some notion of pairwise distance between data points based on this network (e.g. shortest-path length for Isomap [21]). The aim is to approximate the actual geodesic distance on the underlying manifold. (3) Map points to some space based on the pairwise distances. Possible ways of doing this include the following: (a) use a multidimensional scaling algorithm, which finds an embedding that preserves pairwise distances as well as possible; or (b) take distances to be coordinates in a space of dimension equal to the number of data points (the approach that contagion maps take as a manifoldlearning technique [20]). Many well established manifold-learning techniques perform poorly when faced with noisy data. Isomap, for instance, can be very sensitive to noise. Consider, for example, a noisy point sample on the Swiss roll (see Figure 1). Noise can lead to two points on adjacent sheets lying close together. The k-nearest-neighbour graph might then have an edge that connects the corresponding nodes (i.e. a 'short-circuit error'), although the points lie far apart in the intrinsic geometry. Consequently, Isomap falsely considers the two points to be close, and thus fails as a manifold-learning technique in this case.
Contagion maps [20] can circumvent Isomap's 'short-circuit error' issue by exploiting the 'social reinforcement' phenomenon that characterizes threshold contagions. When the threshold of a contagion is small enough to allow spreading via a single edge, the associated contagion map can be viewed as a variant of Isomap and is similarly sensitive to the type of noise described above. For larger thresholds, however, a single errant edge in the k-nearest-neighbour graph cannot carry a contagion, and, as a result, the contagion map does not view the two points as close and performs well as a manifold-learning technique. The distance between two points according to the ambient space can differ significantly from the geodesic distance between the same two points along the underlying two-dimensional manifold. (B) The Isomap algorithm first builds a neighbourhood graph on the point cloud and then finds the length of a shortest path between any pair of nodes in this network. (C) The length of a shortest path between two nodes in the network approximates the geodesic distance between the corresponding two points under favourable conditions [2]. Isomap performs classical multidimensional scaling based on the set of shortest-path distances. (Figure taken from [21].) We use persistent homology, a method from topological data analysis [6], as well as more established statistical techniques to perform manifold learning based on contagion dynamics, and we compare this approach to Isomap-type algorithms. One of the most common applications of persistent homology is the task of recovering a manifold from a random, potentially noisy sample of points from it [4]. This application illuminates the natural overlap of topological data analysis with manifold learning.
Both are designed to find shape regardless of exact geometry (including measures of curvature and length), and both aim to be robust to noise. Traditionally, they differ in their respective approaches and, as a result, in their ability to identify different types of structural features. Persistent homology can, for example, identify a sphere (by its topological features in dimensions 1 and 2), but not a Swiss roll (as it has no non-trivial topological features). A manifold-learning algorithm like Isomap, on the other hand, can 'unroll' the Swiss roll (under favourable conditions), but cannot see that a sphere is a two-dimensional manifold: Isomap detects a sphere's lowest embedding dimension 3, but cannot see its intrinsic 2-dimensional structure. In this paper we combine the two approaches, by processing our data via a manifold-learning-type procedure first and then computing persistent homology (along with some other measures) based on this processed data.

Algorithms
The fundamental hypothesis that our algorithms are built on is that our data come as samples from some underlying submanifold of R n , which we want to infer. To this end, we perform variants of a procedure whose basic steps are as follows.
First, if a data set is given in the form of a point cloud, we start by constructing a neighbourhood graph based on this point cloud whose nodes are the points and whose edges connect nearby pairs of nodes. We construct such a graph in two different ways: (1) by connecting each point to its k closest neighbours, producing the k-nearestneighbour graph; and (2) by connecting any two points that are within from one another, producing the -neighbourhood graph. In both types of neighbourhood graph, one can either weight the edges by the corresponding pairwise distances, or treat the edges as unweighted 1 .
Second, we calculate a notion of distance between points that is aimed to be an estimate for the actual geodesic distance on the underlying manifold. The idea is that only the pairwise Euclidean distances between neighbouring pairs of points approximate the geodesic distances sufficiently, and that estimates for geodesic distances between non-neighbouring pairs of points can be inferred from the distances between neighbouring points by 'tracing' through the neighbourhood graph.
The precise pairwise distances between adjacent points in a neighbourhood graph provide information that is relevant to estimating the geodesic distance between nonneighbouring points. Unweighted neighbourhood graphs forget this information and thus tend to lead to less accurate approximations to the geodesic distances. The loss of information from taking an unweighted graph can be greater for k-nearest-neighbour graphs than for -neighbourhood graphs, because, in the latter case, the pairwise distances are within a range that is capped by .
2.1. Contagion maps. First, given data in point-cloud form, our algorithm starts by building a neighbourhood graph (V, E) on the point cloud. It does so by associating a set V of nodes to the data points (where i is the node associated to point p i ) and defining the edge set E to build either (1) a k-nearest-neighbour graph, or (2) an -neighbourhood graph: (1) Given some k ∈ N, (i, j) ∈ E if and only if p i is in the set of the k nearest neighbours of p j , or vice versa. (2) Given some ∈ R >0 , (i, j) ∈ E if and only if d 2 (p i , p j ) ≤ .
If we are given data in the form of a network, we use this given (weighted or unweighted) network instead.
We denote the graph by (V, E), the number of nodes (i.e. the number of points in the case of point-cloud data) by |V | = N , and the graph's binary adjacency matrix by A. We then consider a threshold contagion on this network. We denote the state of node i ∈ V at time t by η i (t), which takes the value 1 if it is active and the value 0 if it is inactive. Given a set of seed nodes consisting of a node j ∈ V together with its immediate neighbours that are active at time t = 0, and a threshold T , we update node states synchronously in discrete time steps according to the following rule. If η i (t) = 1, then η i (t + 1) = 1. If η i (t) = 0, then Given a network (V, E) and a threshold T , a contagion seed yields a deterministic process, which we call a realization of the contagion model with T on (V, E). The activation time of node i in the realization seeded around node j is the smallest t such that η i (t) = 1, and we denote it by x (i) j . If node i is never activated in the realization that is seeded around node j ∈ V , we set x (i) j = 2N (i.e. larger than any actual activation time).
One can now work directly with this set of activation times, that is, treat the activation times as estimates to the geodesic distance between points on the underlying manifold and use them to examine geometry, topology, and dimensionality of the data. Alternatively, one can work with points whose coordinate vectors are given by the columns of the dissimilarity matrix D cont = x (j) i i,j∈V that holds the activation times (or of a symmetrization of this dissimilarity matrix given by D cont + (D cont ) T ). Using terminology from [20], producing such a point cloud is equivalent to mapping the nodes via a contagion map.
Definition 2.1. The regular contagion map associated to (V, E) and T is the function from the set V of nodes to R N that is defined by The symmetric contagion map associated to (V, E) and T is the function from the set V of nodes to R N that is defined by In this paper, we work with symmetric contagion maps exclusively. We examine dimensionality, topology, and geometry as follows. We perform classical multidimensional scaling (MDS) [22] based either on the activation times directly, or on the Euclidean distances between points in the image of the contagion map. MDS aims to embed a point cloud in a given low-dimensional vector space in a way that preserves given distances between pairs of points as well as possible. It does so by minimizing a cost function called 'strain': Given a matrix D = (d ij ) i,j∈I of pairwise distances, or 'dissimilarities' (not necessarily satisfying the defining properties of a metric), and some Euclidean target space Y , MDS finds coordinate vectors {y i ∈ Y } i∈I that minimize the cost function ij and H ij = δ ij − 1/|I| [13]. MDS is a linear dimensionality-reduction technique when applied to Euclidean distances. By applying it to sensible approximations to the geodesic distances between data points, we hope to recover potentially curved structure. In other words, we hope to use MDS to achieve non-linear dimensionality reduction.
Given an embedding via MDS to Euclidean space of dimension p, we calculate its residual variances [5] R where ρ (p) is the Pearson correlation coefficient [17] between the given pairwise distances {d ij } i,j∈I and the corresponding pairwise Euclidean distances { y i − y j 2 } i,j∈I between points in the embedding. We determine the approximate embedding dimension P of the data (according to the given pairwise distances) by finding the smallest dimension such that the residual variance of the embedding via MDS to that dimension is less than 5%, that is, In addition to these dimensionality considerations via MDS, we analyse our data topologically by computing the persistent homology of the Vietoris-Rips filtration [8] based either on the activation times directly, or on the Euclidean distances between points in the image of the contagion map. When a given base-geometry is given, we also examine our data geometrically through a Pearson correlation coefficient between that base-geometry and the given dissimilarity measure. Note that such a known base-geometry to compare our processed data to is not usually given in manifoldlearning applications. The measure is, however, useful when testing the algorithm on benchmark data.
When analysing the point cloud given by the columns of D cont (in other words, the contagion map), we are essentially applying our methods to a dissimilarity matrix that encodes the pairwise distances between the column vectors of D cont . We denote the operator that maps D cont to that matrix as

2.2.
Isomap. The Isomap algorithm [21] is essentially a combination of a shortestpath algorithm with MDS. In a sense, Isomap works as a 'nonlinear version' of MDS which accommodates for potential curvature of data by incorporating a shortest-paths algorithm to estimate geodesic distances between data points.
The original Isomap algorithm proceeds as follows. First, given point-cloud data, Isomap starts by building a neighbourhood graph (V, E) on the point cloud, as described for contagion maps in Section 2.1 above. Next, Isomap calculates the shortestpath lengths between pairs of nodes in this network using some shortest-path algorithm. We use the Floyd-Warshall algorithm [7,23] in the following work. The set of shortest-path lengths can be recorded in a dissimilarity matrix D iso = (d G (i, j)) i,j∈V 3 , to which Isomap finally applies MDS to map the data points to a low-dimensional space.
As for contagion maps, if data is given in the form of a network, we will work with this given network instead of a neighbourhood graph. Moreover, in addition to the original Isomap algorithm, which simply projects points via MDS based on the set of shortest-path lengths (i.e. the entries in D iso ), we calculate the residual variances of these projections, and we also examine this set topologically (via the persistent homology of the Vietoris-Rips filtration based on these shortest-path lengths) and geometrically (via a Pearson correlation [17] with some given base-geometry), when possible. Furthermore, we analyse the point cloud given by the columns (or, equivalently, rows) of D iso , that is, we analyse the entries in p dist (D iso ).
Note that a contagion map with threshold T = 0 is approximately equivalent to a version of Isomap that uses an unweighted neighbourhood graph.

Workflow.
Our workflow is composed of multiple stages, at each of which one can choose from a number of different options. This leads to exponentially many possible procedures that one can use to analyse a given data set. First, given pointcloud data, one needs to choose the type of neighbourhood graph to build on this data set, as well as the defining parameter k or . Next, one needs to pick a way of estimating geodesic distances based on this graph. We choose either shortest-path distance or activation times in a threshold contagion; that is, we follow either the Isomap algorithm or that of contagion maps. In the case of contagion maps, one also needs to choose a threshold parameter T . Given the set of estimates for the geodesic distances, i.e. the dissimilarity matrix that encodes the shortest-path (D iso ) distances or activation times (D cont ), one can apply further methods either to these estimates directly, or to the pairwise distances between the points whose coordinate vectors are the columns (or rows, by symmetry) of this dissimilarity matrix. For either of these choices one can finally apply methods to determine dimensionality, topology, and geometry. Figure 2 shows a schematic representation of our workflow. We apply different subsets of the full analysis to the different data sets that we consider.

Results
We apply Isomap, as well as contagion maps with several different thresholds, to three different data sets. First, we consider point samples from a Swiss roll, a classical benchmark data set for dimensionality reduction and one of the first data sets to which Isomap was applied [21]. We then analyse a couple of representatives of a class of torus-based networks, which was studied in [12]. The toroidal structure underlying these networks allows us to examine the topological aspect of our methods by looking to recover the torus's nontrivial topological features. Finally, we consider a data set that represents the conformation space of the cyclo-octane molecule [14]. This data set is known to have non-trivial topological features and is an example of a naturally occurring data set.
3.1. Noisy samples from a Swiss roll. We first examine point samples from a Swiss roll that are obtained by taking regularly spaced points on the Swiss roll surface and then adding various levels of noise to these points. This way of generating data makes it possible to have direct control over the data, so one can explore how different algorithms react to slight variations of the data (in terms of e.g. density, noise level, or uniformity). We use this data set primarily to explore the effects of the parameter k or when building a neighbourhood graph.
We start by taking points on a Swiss roll at a density of approximately 50 per unit square, regularly spaced with respect to the intrinsic geodesic distance on the Swiss roll (see Figure 3(a)). We then add Gaussian noise with a specified signal-to-noise ratio (S/N ) to these regularly spaced points (see Figure 3(b)). That is, for each point p = [p 1 , p 2 , p 3 ] in this regularly space point sample, we add independent, identically distributed noise drawn from a zero-mean normal distribution to each of its coordinates to obtain a perturbation p noisy of the point: We test Isomap and contagion maps on this noisy point cloud to see how well each of them sees the underlying 2-dimensional space. Each algorithm starts by building a neighbourhood graph on the points (see Figure 3(c,d)).  We have already touched on Isomap's sensitivity to 'short-circuit errors' in the introduction. However, a careful choice of (or k) when constructing the neighbourhood graph can mitigate such errors to some extent [1]. The goal is to find an (or k) that is small enough to avoid short-circuit edges, but not so small that the resulting graph 'corrupts' the underlying space. One may choose to simply vary over a range and implement Isomap on all of the neighbourhood graphs that thus arise. This approach is in the same vein as considering the full range of thresholds for the contagion map algorithm, and it works whenever there exists a range of (or k) for which the resulting neighbourhood graphs correctly represent the underlying topology. However, for some data sets -particularly those that are sparse and incorporate a high level of noiseit is impossible to find a value for (or k) that strikes a balance between covering the underlying topology and not making 'short-circuit errors'. In other words, the range of (or k) that 'corrupt' the underlying topology and the range of (or k) that make 'short-circuit errors' overlap, leaving no values of (or k) that yield neighbourhood graphs that correctly represent the underlying topology. For such data sets, Isomap is inadequate as a manifold-learning tool, but contagion maps may be effective.
See Figures 4 and 5 for examples on the Swiss roll that illustrate the concepts in this paragraph. In particular, Figure 4 shows an example of a data set for which a careful choice of generates a neighbourhood graph that both captures the underlying manifold and does not include 'short-circuit' edges. By contrast, Figure 5 shows an example of a data set, for which no choice of produces a neighbourhood graph that accurately represents the underlying manifold. Figure 6 shows the residual variances of projecting this data set via MDS to dimensions 1 to 10 when based on Isompap, and when based on the contagion map with T = 0.2 (both starting with a 0.18-neighbourhood graph). For the contagion map, the residual variance plunges at dimension 2, thereby correctly identifying the intrinsic dimension of the data. The residual variances for Isomap, on the other hand, only decrease slighty and continuosly across the increasing target dimensions. That is, Isomap fails to see the correct intrinsic structure of the data when starting with an -neighbourhood graph for = 0.18 (or any other value of ), while contagion map -with a suitable choice of and T -correctly identifies the underlying structure. For contagion maps to work in this case, the value of had to be chosen large enough for the neighbourhood graph to cover the underlying manifold; and the value of T had to be picked small enough to carry the contagion and large enough to be resistant to the unavoidable noisy inter-sheet edges in the -neighbourhood graph.  If is too small (e.g. = 0.14), the -neighbourhood graph does not adequately 'cover' the underlying Swiss roll. If is too large (e.g. = 0.18), the -neighbourhood graph includes inter-sheet edges, and thus does not represent the underlying Swiss roll. However, there exists a range of for which the -neighbourhood graph covers the underlying surface and does not include inter-sheet edges, thus providing an authentic representation of the underlying Swiss roll. In other words, the pairwise distances between points whose corresponding nodes are adjacent in the -neighbourhood graph for such approximate the actual geodesic sufficiently, and approximate pairwise geodesic distances between other point pairs can be inferred through the Isomap algorithm. This is an example of a data set for which Isomap is suitable as a manifold-learning technique with a careful choice of . For small , the -neighbourhood graph does not adequately 'cover' the underlying Swiss roll. As increases, noisy inter-sheet edges appear (for e.g. = 0.12) before is large enough for the neighbourhood graph to adequately 'cover' the underlying Swiss roll. This is an example of a data set for which Isomap cannot be used successfully as a manifold-learning technique with any choice of . We now consider 2000 points of the Swiss roll data set from [21]. This data set consists of 20000 points in total. Both Isomap and contagion maps perform adequately for the high signal-to-noise ration of S/N = 20 (i.e. low noise level) with all four examined versions of neighbourhood graphs (see Figure 8).
For the lowest signal-to-noise ratio (i.e. greatest noise level) that we considernamely S/N = 5 -the 8-nearest-neighbour graph includes noisy inter-sheet edges. As a result, Isomap does not detect the intrinsic dimension 2 of the Swiss roll when using the 8-nearest neighbour graph, and neither does the contagion map with T = 0 or T = 0.1, thresholds for which the activation times of our threshold contagion are close to the shortest paths in the unweighted neighbourhood graph (see Figure 10). With T = 0.2, however, the contagion map does correctly recover the intrinsic dimension 2, as this threshold is just large enough to be robust to the occurring noisy edges. For thresholds larger than T = 0.2, many of the realizations of our threshold contagion leave nodes in the neighbourhood graph inactive (recorded as 'infinite' activation times), and, as a result, the residual variances of the embeddings based on these activation times are large for all considered dimensions (1 to 10). This illustrates that, while contagion maps can be a powerful tool when dealing with such noisy edges, a suitable choice of threshold can be a delicate matter.
Similarly, for signal-to-noise ratio S/N = 5, Isomap fails when based on the 4.5neighbourhood graph or the 5-neighbourhood graph, but the contagion map for a threshold of T = 0.2 successfully identifies the intrinsic dimension 2 for both examined values of the neighbourhood parameter . Furthermore, when based on a 5neighbourhood graph, Isomap fails even for the higher S/N = 10, as the 5-neighbourhood graph includes noisy inter-sheet edges even for this lower noise level (see Figure 9).
Note that our measures for topology and geometry are not useful for this data set, as the underlying manifold has no non-trivial topological features, and there is no base-geometry provided.

3.2.
Torus-based networks. We consider the torus-based model described in [12] with N = 2500 nodes and a geometric degree of d G = 8 (see Figure 11). Networks in this model are similar to Kleinberg's small-world like network [10]. They consist of a periodic grid of nodes that are connected via geometric edges (i.e. edges between neighbouring nodes) in a regular manner, and to which non-geometric edges are added according to a probability distribution. We add first 2 and then 4 non-geometric edges per node uniformly at random (i.e. d NG = 2 or 4, and γ = 0, using the parameters described in [12]) and apply versions of both Isomap and contagion maps (with thresholds T = 0, 0.1, . . . , 1) to the resulting networks. Namely, we calculate the shortest-path lengths between pairs of nodes in these two unweighted networks, as well as the activation times in all realizations of our threshold contagion that are seeded at the direct neighbourhoods of individual nodes (the red nodes in Figure 11). We thus obtain two dissimilarity matrices, one holding the shortest-path lengths (D iso ) and one holding the symmetrized activation times (D cont ). We analyse the information held in these two dissimilarity matrices geometrically, topologically, and in terms of dimensionality in two ways each. We first analyse the estimated pairwise geodesic distances held in the dissimilarity matrices directly, and we then consider the point cloud that results from taking columns (or, equivalently, rows) of each dissimilarity matrices as the coordinate vectors of points in R 2500 . In detail, we perform the following analyses: • In terms of dimensionality: We perform MDS based on the entries in each dissimilarity matrix to dimensions 1 to 10 and record the residual variance for each dimension. We also perform MDS on the point cloud that results from taking columns (or, equivalently, rows) of each dissimilarity matrix as the coordinate vectors of points in R 2500 . In both cases, we identify the approximate embedding dimension as the lowest dimension such that the residual variance when projecting down to that dimension via MDS is below 5%. • Topologically: We build Vietoris-Rips filtrations based on the approximations to the pairwise geodesic distances (i.e. the entries in each dissimilarity matrix) and compute their persistent homologies. We also build Vietoris-Rips filtrations on the points cloud that results from taking columns (or, equivalently, rows) of each dissimilarity matrix as the coordinate vectors of points in R 2500 and compute their persistent homologies. • Geometrically: We calculate the Pearson correlation coefficient between the entries in each dissimilarity matrix and the corresponding pairwise distances between regularly spaced points on a torus: x, y ∈ {0, 1, . . . , n − 1} . (1) We also calculate the Pearson correlation coefficient between the pairwise distances between points in the point cloud that results from taking columns (or, equivalently, rows) of each dissimilarity matrix as the coordinate vectors of points in R 2500 and the corresponding pairwise distances between the regularly spaced points on a torus (1). We find that Isomap is unable to infer the underlying torus structure from these networks. Contagion map, however, detects the characteristics of the torus when using a threshold of T ≈ 0.2. The results in this section illustrate the utility of contagion maps for spatial network data that incorporates noisy edges, and its potential to outperform Isomap in such scenarios, but they also highlight that a careful choice of T is critical. Figure 11. Illustration of the purely geometric base network of the networks that we consider in this section. This network is similar to Kleinberg's smallworld like network [10]. Each node has 8 geometric neighbours; nodes on opposite sides of the illustration are adjacent. The set of dark red nodes consists of one node and its immediate neighbours. We consider realizations of our threshold contagion that are seeded at such a set of nodes. The set of medium colour (respectively, light colour) nodes consists of the nodes that are activated in the first (respectively, second) time step when T < 3 8 . We consider this network (on 2500 nodes) with 2 and 4 non-geometric edges per node added uniformly at random.

3.2.1.
Dimensionality. MDS based on Isomap does not identify the embedding dimension 4 of a torus for either d NG = 2 or d NG = 4 (see Figure 12(a,f) and Figure 13(a,f)). The residual variance based on contagion maps does have a dip at dimension 4 for the threshold T = 0.2 (see Figure 12(d,i) and Figure 13(d,i)), but does not when the threshold is T = 0.1 or T = 0.3. Note that for Isomap, as well as contagion maps with all considered thresholds, the residual variances are smaller for all considered dimensions when the analysis is done on the point cloud, making the results for contagion map with T = 0.2 look sharper.
We identify the approximate embedding dimensions for Isomap and contagion maps with thresholds T = 0, 0.1, . . . , 1 and show the results in Figure 14 (for the torus-based network with d NG = 2) and Figure 15 (for the torus-based network with d NG = 4). Both versions of Isomap (the one performing MDS based on the entries in D iso and the one performing MDS based on the distances between the rows of D iso ) vastly overestimate the embedding dimension for the torus-based network with d NG = 2 and the one with d NG = 4. When performing MDS based on the entries in D iso , the approximate embedding dimension is at least 100 (which is the dimension at which we cap our computations). When performing MDS based on the distances between the rows of D iso , the embedding dimensions are still very large: It is 61 for the network with d NG = 2, and 95 for the network with d NG = 4. Note that these results are practically identical to those for contagion map with T = 0, as we are working with the same unweighted graphs in both Isomap and contagion maps. For contagion maps with varying thresholds T , the approximate embedding dimension has a dip around T = 0.2 (see Figure 14 (b) and Figure 15 (b)), except when performing MDS based on the entries in D cont for the network with d NG = 4, in which case contagion maps return an embedding dimension of at least 100 for all thresholds (see Figure 15 (a)).

3.2.2.
Topology. Figures 16 and 17 show the barcodes corresponding to the persistent homology in dimension 1 of the Vietoris-Rips filtrations built according to the different versions of Isomap and contagion maps. The barcodes in dimension 1 of the Vietoris-Rips filtration based on the estimated geodesic distances (i.e. the entries in D iso and D cont ) do not seem to reveal any significant features for either Isomap or contagion maps. (See panels (a-e) of Figures 16 and 17). The barcode in dimension 1 of the Vietoris-Rips filtration on the point cloud based on Isomap (i.e. given by the rows of D iso ) on the network with d NG = 2 does feature two dominant bars (see Figure 16(f)), as do the barcodes corresponding to point clouds based on contagion maps for T = 0, T = 0.1, and T = 0.2 (i.e. given by the rows of D cont ) (see Figure 16 (g-i)). For the network with d NG = 4, however, the barcode in dimension 1 of the Vietoris-Rips filtration on the point cloud based on Isomap does not have any dominant bars, whereas the ones based on contagion maps for T = 0.2 and T = 0.3 do (see Figure 17 (i,j)).

Geometry.
We examine the geometry of our Isomap and contagion map results by comparing the entries of D iso and D cont , as well as the point clouds given by the rows of these dissimilarity matrices, to the regularly spaced points on a torus (1) via the Pearson correlation coefficient. See Figure 18 for the results for the torusbased network with non-geometric degree d NG = 2 and Figure 19 for the results for the torus-based network with non-geometric degree d NG = 4. Isomap returns a low Pearson correlation in all cases, suggesting that the shortest-path distances are (as expected, given the large number of non-geometric edges) not good estimates to the distances along the torus that underlies these networks. Note that these results are practically identical to those for contagion map with T = 0, as we are working with the same unweighted graphs in both Isomap and contagion maps. For contagion maps with varying thresholds T , the Pearson correlation coefficient peaks around T = 0.2, suggesting that, for thresholds close to T = 0.2, the contagion spreads predominantly via WFP, making the activation times good estimates to the distance along the torus that underlies these networks. A conformation of a molecule is a possible spatial arrangement of its atoms (modulo rotation and translation) [15]. The conformation of a molecule can be specified by the coordinates of each of its atoms in three-dimensional space, giving a point in R 3a , where a is the number of atoms in the molecule. (In this case, each threedimensional coordinate of each atom is a feature and R 3a is the feature space.) The set of such points for all conformations of a molecule is called its conformation space. Each conformation is accompanied by a state of potential energy of the molecule, and a conformation is more likely to occur the lower its associated potential energy. The cyclo-octane molecule has many conformations of comparable potential energy, and its conformation space has been studied in computational chemistry for over 50 years [9,16]. Given the locations of the eight carbon atoms in a conformation of the cyclo-octane molecule, the locations of the hydrogen atoms are determined to minimize energy: The two covalent hydrogen atoms of each carbon atom are positioned to form a tetrahedral arrangement with the two neighbouring carbon atoms that minimizes the potential energy of that subunit of the molecule. The conformation space of cyclo-octane thus lies in R 3×8 = R 24 . It is generally assumed that conformation spaces form low-dimensional manifolds, so identifying the structure of the conformation space of a molecule is essentially a manifold-learning problem. The conformation space of cyclo-octane has been shown to be the union of a sphere with a Klein bottle intersecting in two circles of singularities [3,14], forming a two-dimensional manifold with singularities.
Martin et al. [14] analysed a data set of 6040 points in the conformation space of cyclo-octane, subsampled from a larger data set consisting of 1031644 cyclo-octane conformations. This data set is publicly available as part of the javaPlex software package [19]. To visualize this set of points, Martin et al. mapped the points from R 24 to R 3 via Isomap. We explore different versions of both Isomap and contagion maps on it. Figure 21 shows the residual variances for projections via MDS onto dimensions 1 to 10 based on shortest-path distances (i.e. based on the entries in D iso ), and the visualization of the projection to 3D. Figure 22 shows the residual variances for projections via MDS onto dimensions 1 to 10 based on activation times in contagions with thresholds T = 0.1, 0.2, 0.3, and 0.4 (i.e. based on the entries in D cont ), and the visualizations of the projection to 3D. We see that Isomap and contagion maps with low thresholds (T = 0.1 and 0.2) detect the embedding dimension of the underlying space, suggesting the absence of noisy edges in the 8-nearest-neighbour graph on this data set. Contagion maps with higher thresholds (T = 0.3 and 0.4) do not seem to reveal any meaningful structure. This is likely due to the contagion stabilizing before much of the graph has been activated, leading to many 'infinite' activation times.
In Figure 23 we show barcodes corresponding to the persistent homology in dimension 1 of various Vietoris-Rips filtrations based on the cyclo-octane data set of 6040 points in R 24 . The barcode in panel (a) corresponds to the Vietoris-Rips filtration built directly on the data points in their ambient space R 24 . This barcode has one dominant bar, suggesting that the Klein bottle and the sphere whose union is the conformation space of cyclo-octane intersect in a way that makes the 1-dimensional loop that is present in the homology of the Klein bottle over Z/2Z, but not over Z, nullhomotopic. The other panels show barcodes corresponding to various Vietoris-Rips filtrations that, in a sense, mimic the Vietoris-Rips filtration built according to the intrinsic metric on the underlying manifold. Namely, they are Vietoris-Rips filtrations based on different versions of Isomap and contagion map, that is, based on estimates to the geodesic distance on the underlying manifold. Panel (b) shows the barcode corresponding to the shortest-path distances in the 8-nearest-neighbour graph (i.e. based on the entries in D iso ). Panel (c) shows the Vietoris-Rips filtration based on the points whose coordinate vectors are the columns of D iso . Panel (d) shows the Vietoris-Rips filtration based on the activation times of the contagion with threshold T = 0.2 on the 8-nearest-neighbour graph (i.e. based on the entries in D cont ). Panel (e) shows the Vietoris-Rips filtration based on the points whose coordinate vectors are the columns of D cont . All of these barcodes have one dominant bar, consistent with the homology of the underlying manifold. The barcode in panel (d) has many bars with identical birth and death. This stems from the fact that activation times (in our contagion model) have integer values between 0 and 2N (where N is the number of node, or, equivalently, data points), and so a Vietoris-Rips filtration based on these values has only few filtration steps at which simplices are added.

Conclusion
Isomap is a well established manifold-learning tool and is useful for many data sets. It can successfully handle curvature of data in many cases, and the freedom of choosing the parameter k or when creating a neighbourhood graph allows it to handle noise to some extent. However, when faced with particularly sparse and noisy data, Isomap is prone to so-called 'short-circuit errors', which in some cases cannot be avoided regardless of the choice of k or . For such data, contagion maps can yield better reconstructions. For a suitable choice of the threshold parameter T , single noisy edges that occur in a neighbourhood graph do not carry a contagion and thus do not distort the estimate of the geodesic distances via activation times significantly. In other words, with the right choice of T , contagion maps are able to 'exploit social reinforcement to silence noise'.

Acknowledgements
We thank Vidit Nanda and Ulrike Tillmann for helpful discussions and useful comments on various versions of this paper.