1. Introduction
A multitude of data in various domains, from natural sciences to sociology, is represented as collections of graphs. For example, on a small scale molecules are modeled by atoms and their atomic bonds as nodes and edges in large graph collections. While on a larger scale collections of social networks are analyzed by their community structures within the networks. Analytical tasks run on such collections to classify, for instance, which drugs can be used for the treatment of a disease or how molecules cluster together in functional groups. To fully discern a graph’s properties, representation learning for such analysis requires a
multiscale view of a graph. Representations have incorporated properties ranging from local (e.g., atomic bonds) to global (e.g., community structures).Kernel methods (Borgwardt and Kriegel, 2005; Shervashidze and Borgwardt, 2009; Shervashidze et al., 2011; Yanardag and Vishwanathan, 2015; Kondor and Pan, 2016), dominate the field of graph analytics, as they define functional similarities among pairs of graphs and can perform tasks such as graph classification. Among a plethora of graph kernels, to our knowledge, only the Multiscale Laplacian Graph kernel (MLG) (Kondor and Pan, 2016) preserves multiscale properties. Still, such graph kernels require direct comparisons among pairs of graphs, hence scale quadratic in the size of any graph collection. As more and more data is stored as graph collections, such allpairs direct comparisons methods are rendered inviable.
In another vein, graph representations extract a vector signatures from a graph and perform comparison among those vectors in lieu of the graphs. Initial approaches derived such representations by handcrafted statistics on the graph structure (e.g., the average node degree (Berlingerio et al., 2013)). Recently, supervised neural approaches for graph representation (Atwood and Towsley, 2016; Niepert et al., 2016) attained competitive performance in supervised classification among graphs of a few tens of nodes. However, such neural methods are applicable to particular datasets only, as they require labels to be available; besides, they fail to scale to graphs of a few thousands of nodes. Most recently, Verma et al. (Verma and Zhang, 2017) proposed the Family of Graph Spectral Distances (FGSD): a graph representation method based on histograms of the biharmonic kernel. While FGSD representations are designed for classification tasks, these are neither expressive nor scalable enough to be used in both classification tasks.
In this paper we propose SGR, a selfsupervised method for learning graph representations that is at the same time efficient to compute and customizable to multiple scales, analytical tasks, and datasets. SGR
leverages a graph’s Laplacian spectrum to learn a mapping a collection of graphs to their vector representation, by learning a simple singlelayer perceptron on global structure recognition. The perceptron learns to distinguish synthetic graphs with community structure (i.e., sampled from a stochastic block model
(Karrer and Newman, 2011)) from random graphs by the ErdősRéiny model. SGRrepresentation is selflearning in the sense that it requires no real training data. We conduct an experimental study with several real datasets, using the ensuing graph signature representations on tasks such as graph classification by logistic regression. The results attest the superiority of our approach on classification tasks with real data.
2. Related work
Previous work on learning graph representations falls into three groups, outlined in Table 1.
Properties  Complexity  
Method  Type  Learned  Unsupervised  Multiscale  Precomputation  Comparison 
SP (Borgwardt and Kriegel, 2005)  kernel  ✘  ✘  ✘  
WL (Shervashidze et al., 2011)  kernel  ✘  ✘  ✘  
MLG (Kondor and Pan, 2016)  kernel  ✘  ✔  ✔  
PSCN (Niepert et al., 2016)  supervised NN  ✔  ✘  ✘  
DCNN (Atwood and Towsley, 2016)  supervised NN  ✔  ✘  ✘  
NetSimile (Berlingerio et al., 2013)  fixed representation  ✘  ✔  ✘  
FGSD (Verma and Zhang, 2017)  fixed representation  ✘  ✔  ✘  
cycle2!10 SGR  selflearned representation  ✔  ✔  ✔ 
2.1. Kernel methods
Graph kernels (Gärtner et al., 2003; Borgwardt and Kriegel, 2005; Shervashidze et al., 2011; Yanardag and Vishwanathan, 2015; Nikolentzos et al., 2017; Kondor and Pan, 2016) are similarity functions among graphs, which perform an implicit transformation of graph structure to compare two graphs (e.g. Shortestpath (SP) kernel (Shervashidze et al., 2011)). However, kernel methods are limited due to (i) high ondemand computational complexity at comparison time, which renders them inapplicable to largescale graph comparisons, and (ii) rigidity: once a kernel is chosen, it cannot be tailored to the analytical task or dataset at hand. The Multiscale Laplacian Graph kernel (MLG) (Kondor and Pan, 2016) is a mature work on this domain, as it adapts to different scales via an iterative informationpropagation method. Yet it also raises a computational overhead cubic in Laplacian matrix eigenvalues.
2.2. Supervised neural methods
Advances in neural learning have led to the application of supervised neural
approaches to classify collections of graphs. The Diffusion Convolutional Neural Network (
DCNN) (Atwood and Towsley, 2016) learns graph representations by averaging values after a diffusion process on a graph’s nodes. Similarly, Patchysan (Niepert et al., 2016) learns a representation through a CNN filter after imposing a sampling order on nodes. Yet such approaches share the drawbacks of kernel methods: high computational overhead at comparison time and lack of variable adaptability to local or global structures. Besides, the learning component in these neural methods is supervised by means of node and edge labels, raising an additional resource requirement.2.3. Fixed representation methods
Another class of approaches eschew the supervised learning component of neural approaches. Such works started out using features engineered by aggregating local graph properties such as node degree and neighbors’ degrees
(Bronstein et al., 2011; Berlingerio et al., 2013; Bonner et al., 2016). However, in eschewing supervision, such works eschew learning altogether. We call them fixed representation methods. The Family of Spectral Distances (FSGD) (Verma and Zhang, 2017) produces a highdimensional sparse representation as a histogram on the dense biharmonic graph kernel; however, FGSD does not capture graph features at different scales of resolution or graph sizes, and is also inapplicable to reasonably large graphs, due to its quadratic time complexity.By contrast to the above, we devise a lightweight selflearned representation method, which is extracted directly from the graph structure and can be used across graph analysis tasks.
3. Problem statement
An undirected graph is a pair , where is the set of vertices and the set of edges. Since the vertex set is isomorphic to , we will henceforth use the latter notation. We assume the graph is unweighted, yet our method readily applies to the weighted case. A representation is a function from a graph in a collection of graphs to the dimensional space equipped with the Euclidean metric; the element of the representation is denoted as . Notably, once a graph’s representation is computed, comparisons between representations (e.g., for retrieval or classification) is independent of graph size.
The first and foremost property a representation has to satisfy is permutationinvariance, implying that if two graphs have the same structure (i.e., are isomorphic) the distance between their representations is zero. In other words, we demand that for every graph , the representation is invariant to every permutation of the graph vertices, . In the sequel, we propose representations based on the Laplacian spectrum, which are permutationinvariant by construction.
Another desirable property is scaleadaptivity, implying that the representation shall account for both local (edge and node) and global (community) graph features. A global feature is such that cannot be captured by any combination of features on nodes at distance , where is the diameter (longest shortestpath length) of . Let the set of all subgraphs of be . We define scaleadaptivity as the property of a representation having at least one local feature (i.e., derived solely from information encoded in subgraphs ), and at least one global feature (i.e., derived by strictly more than the information encoded in any ). Using local features only, a similarity measure would deem two graphs sharing local patterns to have nearzero distance although their global properties (e.g., pagerank features) may differ; in reverse, relying on global features only would miss local ones (e.g., degree distribution).
We construct a parametric family of graph representations , with parameter set , such that captures global and local features to different extents, depending on . Further, we adapt to fit a purpose by means of unsupervised selflearning.
4. Spectral graph representations
The adjacency matrix of a graph is a matrix having if and otherwise. The normalized graph Laplacian is defined as the matrix , where is the diagonal matrix with the degree of node as entry , i.e,
. Since the Laplacian is a symmetric matrix, its eigenvectors
, are real and orthonormal. Thus, it is factorized as , where is a diagonal matrix with the sorted eigenvalues , and is the orthonormal matrix having the corresponding eigenvectors as its columns. Belkin and Niyogi (Belkin and Niyogi, 2007)showed that the eigenvectors of the normalized Laplacian of a point cloud graph converge to the eigenfunction of the LaplaceBeltrami operator
(Berger, 2012) on the underlying Riemannian manifold.The set of eigenvalues is called the spectrum of a graph and is bounded in the range . Being an algebraic invariant of the Laplacian, its spectrum is independent of the choice of the basis, which, in particular means that it is permutationinvariant.
4.1. Heat propagation
A useful metaphor for studying the graph structure at different scales is that of a system of connected heatconducting rods corresponding to the graph edges. Heat propagation in such a system is governed by the heat equation associated with the Laplacian,
(1) 
where is a scalar field on the graph vertices representing the amount of heat at each vertex at time . The solution to the heat equation provides the heat at each vertex at time , when the initial heat is initialized with a fixed value on one of the vertices. It has a closedform fundamental solution in the form of the heat kernel matrix,
(2) 
where represents the amount of heat transferred from vertex to vertex in time . The diagonal entries of are called the autodiffusivity function, representing the amount of heat remaining at each graph vertex after time . This autodiffusivity function is affected by increasingly global structures of the graph’s topology as the time parameter grows.
The sum of the autodiffusivity function, known as the heat trace
(3) 
is an algebraic invariant of the heat kernel and can be, therefore, expressed only in terms of the invariant graph spectrum.
Theoretical results by Mémoli (Mémoli, 2011) subscribe the expressiveness of heat traces, suggesting a spectral definition of the GromovWasserstein distance between Riemannian manifolds based on matching the heat kernels at all scales. In what follows, we briefly review this construction, adapting it to graphs. Let us set the cost of matching a pair of vertices in a graph to a pair of points in a graph at a scale to be the discrepancy of the corresponding heat kernels,
where the factor scales the kernels. A distance between the graphs can then be defined in terms of the minimal measure coupling
where the minimum is sought over all doublystochastic matrices representing a discrete measure on that marginalizes to the uniform measures on and . This distance can be thought of as a “soft” version of the standard graph edit distance and has the useful property that iff and are isomorphic.
Mémoli (Mémoli, 2011) showed that the spectral GromovWasserstein distance can be lower bounded by
which is the scaled distance between heat traces of the graphs.
4.2. Learned spectral representations
The heat traces can be viewed as a nonlinear transformation of the graph spectrum of the form with . Sampling the time parameter on some grid yields the following dimensional representation of the graph:
Kernels  Fixed Representations  Selfsup. Repr.  
dataset  SP  GK4  WL  MLG  NetSimile  FGSD  cycle2!10SGR  
D&D  >1D  73.39  68.27  >1D  70.02  64.88  64.54  cycle3!3076.12 
ENZYMES  22.57  19.11  25.11  31.40  28.06  28.85  25.28  cycle3!3033.67 
MUTAG  80.30  80.76  81.16  86.54  83.66  85.23  82.07  cycle3!3086.97 
PROTEINS  72.04  71.48  72.33  73.10  70.59  63.27  71.32  cycle3!3073.83 
COLLAB  >1D  >1D  cycle3!3078.52  >1D  74.26  70.66  66.15  71.98 
IMDBB  57.10  61.79  cycle3!3072.26  59.18  70.96  69.20  63.16  70.38 
IMDBM  39.39  39.80  cycle3!3050.75  34.31  46.80  48.88  41.14  47.97 
REDDITB  >1D  72.30  71.97  >1D  86.84  87.12  76.25  cycle3!3087.45 
REDDITM5k  >1D  23.39  48.57  >1D  44.96  48.51  48.02  cycle3!3053.22 
We propose to extend this view to a more general parametric family of spectrum transformations. Given a graph with vertices, we first compute its spectrum or a part thereof
, and interpolate it producing
on the interval such that . The spectrum is then sampled on a fixed grid with points, producing an dimensional vector with the entries . Note that is insensitive to a graph’s size and invariant to the ordering of its vertices.The interpolated and sampled spectrum
undergoes next a parametric nonlinear transformation implemented as a singlelayered perceptron,
where is an weight matrix, is an
dimensional bias vector, and
is an elementwise SeLU nonlinearity (Klambauer et al., 2017). The resulting dimensional spectral graph representation (SGR) is parameterized by .We propose a regime to train this representation. To obtain a representation capturing predominantly the global structure of the graph (manifested in the lower part of the spectrum), we cotrain jointly with a binary classifier attempting to distinguish between ErdősRényi random graphs and stochastic block model (Karrer and Newman, 2011) graphs of various degrees and sizes, which have very different community structures. The binary classifier is embodied as a single linear layer on top of the output of followed by softmax, and is trained using the regular crossentropy loss.
The classifier is tossed away, leaving an appropriately trained graph representation. This approach is inspired by the versatility of image embeddings obtained from deep neural networks trained on visual recognition tasks. We henceforth denote the representation as SGR. Figure 1 depicts the saliency map for the interpolated spectrum. Perhaps surprisingly, the neural network leaned to utilize not only the global information, but also very local part of the spectrum.
Full eigendecomposition takes time and space. While for graphs with the sparse structure of the Laplacian allows to reduce the complexity to , it is still prohibitive for large graphs. Instead, we compute top and bottom eigenvalues, and use interpolation in between. This reduces complexity to in the general case and to in the case of bounded degree graphs.
5. Experiments
We evaluate SGR on classification and clustering tasks on a variety of real graph collections. We compare against stateoftheart kernels and graph representation methods, in terms of accuracy and running time. In order to ensure experimental repeatability we provide data, parameters, and source code^{1}^{1}1Will be available upon publication.
Experimental setup. We ran experiments on a 20core Intel Xeon CPU E52640v4, 3.20GHz machine with 256Gb RAM. Unless otherwise stated, we repeat each experiment times and report the average across all trials. SGR interpolates the spectrum of the normalized Laplacian of each graph in the collection through cubic splines; we use values uniformly sampled in the interpolated spectrum.
We compare SGR against representative graph kernel methods: the ShortestPath (SP) (Borgwardt and Kriegel, 2005) kernel, the Graphlet kernel (GK4) (Shervashidze and Borgwardt, 2009), the WeisfeilerLehman kernel (WL), and the stateoftheart Multiscale Laplacian Graph kernel (MLG) (Kondor and Pan, 2016), using default parameters for each method. We also compare SGR against NetSimile (Berlingerio et al., 2013) and FGSD (Verma and Zhang, 2017) graph representations. We additionally report the results of a naïve baseline spectral representation () that represents the graphs with a dimensional vector sampled uniformly from a cubic splineinterpolated (Dierckx, 1995) spectrum of the normalized Laplacian.
Datasets. We use graph collections from the standard benchmark for Graph Kernels (Kersting et al., 2016). Such collections describe either social interactions (e.g., REDDITB from messages in the Reddit platform) or biological connections (e.g., proteinprotein interactions in PROTEINS). The number of graphs in each collection varies from (MUTAG) to (REDDITM5k), while the average graph size varies from (MUTAG) to (REDDIT).
5.1. Classification
In our classification experiment, on each of the datasets we randomly select 80% of the data for training, and 20% for testing. We train an SVM using LibSVM (Chang and Lin, 2011) with default parameter and each kernel. For all graph representations, including SGR, we train a logistic regression classifier with default and regularization. Table 2 reports the classification accuracy averaged over runs.
Our method attains good quality in almost all datasets except for IMDB datasets, for which FGSD outperforms SGR. Due to the small average graph size and density of these datasets, the task becomes harder for our selfsupervised approach that relies on local and global graph structures. At the same time, while stateoftheart kernels (MLG) outperform SGR, they fail to deliver results on medium and large collections in less than one day.
6. Conclusions
We introduced SGR, a lightweight and concise graph representation that is selflearned by means of a singlelayer perceptron over a collection of synthetically generated graphs. In particular, SGR learns a singlelayer perceptron encoding global and local graph properties as nonlinear transformations of the graphs’ Laplacian spectra; thus, it can adapt to a multitude of analytical tasks and application domains. Through extensive experimentation, we established that SGR achieves accuracy matching (or negligibly below) that of the most computationally demanding kernel methods on graph classification and clustering. In the future, we want to investigate more advanced architectures, and ways to incorporate both node and edge labels into the learning task.
References
 (1)
 Atwood and Towsley (2016) James Atwood and Don Towsley. 2016. Diffusionconvolutional neural networks. In Advances in Neural Information Processing Systems.
 Belkin and Niyogi (2007) Mikhail Belkin and Partha Niyogi. 2007. Convergence of Laplacian eigenmaps. In Advances in Neural Information Processing Systems. 129–136.
 Berger (2012) Marcel Berger. 2012. A panoramic view of Riemannian geometry. Springer Science & Business Media.
 Berlingerio et al. (2013) Michele Berlingerio, Danai Koutra, Tina EliassiRad, and Christos Faloutsos. 2013. Network similarity via multiple social theories. In ASONAM. 1439–1440.
 Bonner et al. (2016) Stephen Bonner, John Brennan, Ibad Kureshi, G Theodoropoulos, and AS McGough. 2016. Efficient Comparison of Massive Graphs Through The Use Of Graph Fingerprints. In Twelfth Workshop on Mining and Learning with Graphs (MLG) Workshop at KDD’16.
 Borgwardt and Kriegel (2005) Karsten M Borgwardt and HansPeter Kriegel. 2005. Shortestpath kernels on graphs. In Data Mining, Fifth IEEE International Conference on. IEEE, 8–pp.
 Bronstein et al. (2011) Alexander M Bronstein, Michael M Bronstein, Leonidas J Guibas, and Maks Ovsjanikov. 2011. Shape google: Geometric words and expressions for invariant shape retrieval. TOG 30, 1 (2011), 1.

Chang and Lin (2011)
ChihChung Chang and
ChihJen Lin. 2011.
LIBSVM: a library for support vector machines.
TIST 2, 3 (2011), 27.  Dierckx (1995) Paul Dierckx. 1995. Curve and surface fitting with splines. Oxford University Press.
 Gärtner et al. (2003) Thomas Gärtner, Peter Flach, and Stefan Wrobel. 2003. On graph kernels: Hardness results and efficient alternatives. In Learning Theory and Kernel Machines. Springer, 129–143.
 Karrer and Newman (2011) Brian Karrer and Mark EJ Newman. 2011. Stochastic blockmodels and community structure in networks. Physical review E (2011).
 Kersting et al. (2016) Kristian Kersting, Nils M. Kriege, Christopher Morris, Petra Mutzel, and Marion Neumann. 2016. Benchmark Data Sets for Graph Kernels. (2016). http://graphkernels.cs.tudortmund.de http://graphkernels.cs.tudortmund.de.
 Klambauer et al. (2017) Günter Klambauer, Thomas Unterthiner, Andreas Mayr, and Sepp Hochreiter. 2017. Selfnormalizing neural networks. In Advances in Neural Information Processing Systems. 972–981.
 Kondor and Pan (2016) Risi Kondor and Horace Pan. 2016. The multiscale laplacian graph kernel. In Advances in Neural Information Processing Systems. 2990–2998.
 Mémoli (2011) Facundo Mémoli. 2011. A spectral notion of Gromov–Wasserstein distance and related methods. Applied and Computational Harmonic Analysis 30, 3 (2011), 363–401.

Niepert
et al. (2016)
Mathias Niepert, Mohamed
Ahmed, and Konstantin Kutzkov.
2016.
Learning convolutional neural networks for graphs.
In
International conference on machine learning
.  Nikolentzos et al. (2017) Giannis Nikolentzos, Polykarpos Meladianos, and Michalis Vazirgiannis. 2017. Matching Node Embeddings for Graph Similarity.. In AAAI. 2429–2435.
 Shervashidze and Borgwardt (2009) Nino Shervashidze and Karsten M Borgwardt. 2009. Fast subtree kernels on graphs. In Advances in neural information processing systems. 1660–1668.
 Shervashidze et al. (2011) Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M Borgwardt. 2011. Weisfeilerlehman graph kernels. Journal of Machine Learning Research 12, Sep (2011), 2539–2561.
 Verma and Zhang (2017) Saurabh Verma and ZhiLi Zhang. 2017. Hunt For The Unique, Stable, Sparse And Fast Feature Learning On Graphs. In Advances in Neural Information Processing Systems. 87–97.
 Yanardag and Vishwanathan (2015) Pinar Yanardag and SVN Vishwanathan. 2015. Deep graph kernels. In KDD. 1365–1374.