A New Space for Comparing Graphs.

Anshumali Shrivastava, Ping LiarXiv 2014

TL;DR

This paper introduces a novel way to represent graphs as symmetric positive semidefinite covariance matrices derived from truncated power iterations of their adjacency matrices. This representation is a "graph invariant" that captures both spectral properties and local structural counts (like triangles) while remaining computationally efficient and scalable for large-scale social network classification.

What Problem Does This Paper Address?

Comparing two graphs is a fundamental challenge in machine learning. Whether you are classifying social circles or clustering scientific collaboration networks, you first need a mathematical representation that allows for direct comparison.

Existing approaches often fall into two camps, both with significant drawbacks:

  1. Subgraph Counting: Counting small structures (like triangles or 4-node subgraphs) is intuitive but becomes computationally explosive as the size of the subgraph increases. Testing for graph isomorphism during the counting process is a major bottleneck.
  2. Spectral Methods: Using eigenvalues of the adjacency matrix captures global structure, but eigenvalues aren't directly comparable across graphs of different sizes, and they don't always map cleanly to a common feature space.

The authors seek a "middle ground": a representation that is invariant to node reordering, captures both local and global features, and scales linearly with the number of edges.

Methods

The authors propose representing a graph with adjacency matrix $A$ as a $k \times k$ covariance matrix $C^A$.

  1. Power Iteration: They start with a vector $e$ (all ones) and perform $k$ steps of power iteration ($Ae, A^2e, \dots, A^ke$). This process effectively "spreads" information across the graph; at step $t$, the value at a node represents a weighted sum of its neighbors' values from step $t-1$.
  2. Covariance Matrix: They treat the resulting vectors as a set of $n$ observations in a $k$-dimensional space. The final representation is the covariance matrix of these vectors.
  3. Similarity Measure: To compare two graphs, they use the Bhattacharya similarity between their respective covariance matrices. This is a standard measure for comparing probability distributions (specifically Gaussians, which these covariance matrices naturally parameterize).

Crucially, this entire process is $O(mk + nk^2)$, where $m$ is the number of edges and $n$ is the number of nodes. Since $k$ is typically very small (4 to 6), the method is highly scalable.

Datasets

The authors evaluated their method on two primary classification tasks:

  • Scientific Collaboration (COLLAB): Ego networks of researchers from three fields: High Energy Physics, Condensed Matter Physics, and Astrophysics. The goal is to classify a researcher's field based on their collaboration patterns.
  • Social Network (SOCIAL): A binary classification task distinguishing real Twitter ego networks from synthetic random graphs (Erdos-Reyni) with the same number of nodes and edges.

The statistics for these datasets are summarized in the table below:

Graph statistics for the COLLAB and SOCIAL datasets

Key Insights and Ideas

  • Graph Invariance: The authors prove that their covariance representation is a "graph invariant." This means that if you shuffle the labels of the nodes, the resulting matrix $C^A$ remains exactly the same, which is a prerequisite for any robust graph comparison tool.
  • Encoding Local Structure: A key "aha" moment is the proof that these covariance values are directly related to counts of small sub-structures. For example, the entry $C^A_{1,2}$ is a function of the number of triangles and paths of length 3 in the graph.
  • Path Decomposition: The paper provides a beautiful visualization of how different path types (simple paths vs. paths with repeated nodes) contribute to the power iteration terms.

Different types of paths of length 2 and 3 that contribute to the matrix representation Visualizing how triangles and simple paths are counted in the power iteration

  • Spectral Link: The representation also acts as a "lossless" encoding of the graph's spectrum (eigenvalues). It captures the specific spectral densities associated with scale-free and small-world networks.

Key Results

The proposed method consistently outperformed state-of-the-art baselines, including subgraph frequency counts (SUBFREQ) and random walk kernels (RW).

  • Accuracy: On the COLLAB dataset, the proposed method achieved up to 98.22% accuracy for binary classification (HEP vs CM) and 83.56% for the full three-way classification, outperforming 5-subgraph counting.
  • Efficiency: The speedup is dramatic. For the SOCIAL dataset, computing all pairwise similarities took roughly 177 seconds for the proposed method ($k=4$), compared to over 5,600 seconds for 5-subgraph counting.

Detailed accuracy results are shown in the table below:

Prediction accuracies across different tasks

Limitations and Future Work

  • Regular Graphs: The authors acknowledge that for perfectly regular graphs (where every node has the same degree), the covariance matrix becomes a zero matrix, losing all discriminative power. However, they argue that perfectly regular graphs are virtually non-existent in real-world social data.
  • Choice of $k$: If $k$ is too large, the power iteration converges to the principal eigenvector, making the covariance matrix singular and less informative. The authors found that $k=4 \sim 6$ is the "sweet spot."
  • Future Directions: The authors suggest extending this analysis to even larger sub-structures and exploring how other link analysis algorithms (like HITS or PageRank) might be used to generate similar invariant representations.

Summary updated

BibTeX
@misc{shrivastava2014new,
  author = {Anshumali Shrivastava and Ping Li},
  title = {{A New Space for Comparing Graphs.}},
  year = {2014},
  eprint = {1404.4644},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1404.4644},
}
Figure