Graph Classification with 2D Convolutional Neural Networks

TL;DR

The method converts node embeddings into multi-channel histograms for vanilla 2D CNNs, reaching 48.13% on REDDIT-12K.

cs.CV 🟡 Intermediate 2017-07-29 21 views
Antoine Jean-Pierre Tixier Giannis Nikolentzos Polykarpos Meladianos Michalis Vazirgiannis
graph classification 2D CNN node2vec graph kernels representation learning

Key Findings

Methodology

The pipeline has three stages: nodes are embedded with spectral methods or node2vec; PCA aligns and compresses representations across graphs; adjacent principal-component planes are discretized into fixed grids whose cells count nodes. Stacked histograms form a multi-channel image, processed by a LeNet-5-inspired 2D CNN. Input size is independent of graph size, while continuous node attributes can be added as extra channels.

Key Results

  • With 10-fold cross-validation repeated three times, the synthetic five-class graph set reached 99.08%±3.21 accuracy. On real data, the method achieved 89.12% on REDDIT-B, 52.11% on REDDIT-5K, 48.13% on REDDIT-12K, and 77.12% on PROTEINS full.
  • It improved over the strongest competitors by 2.82 points on REDDIT-B, 6.81 on REDDIT-12K, 1.34 on REDDIT-5K, and 0.52 on PROTEINS full. IMDB-B reached 70.40%, within 1.2 points of the leaders.
  • Per-epoch CNN times were approximately 1, 16, 52, 5, and 6 seconds on the principal social datasets, whereas kernel computation reached 20,392 seconds on REDDIT-12K. Removing PROTEINS attributes reduced accuracy from 77.12% to 73.43%.

Significance

The paper converts irregular graphs into regular grids, allowing a mature and scalable vanilla 2D CNN to perform graph classification. This addresses graph kernels’ pairwise-comparison cost, fixed feature design, and emphasis on small independent substructures. For researchers, it offers a compact and reproducible baseline; for practitioners, fixed-size tensors enable GPU batching and straightforward integration with standard vision infrastructure. The approach also provides a simple interface for combining topology with continuous node attributes.

Technical Contribution

The central engineering contribution is the node-embedding–PCA–histogram pipeline. node2vec uses Skip-Gram training over biased random walks and can encode homophily or structural equivalence; PCA mitigates stochastic dimension permutations across graphs; count histograms preserve graph-size information. The CNN uses parallel convolution-pooling branches with region sizes 3, 4, 5, and 6, 64/96 filters, ReLU, dropout, a 128-unit dense layer, and Adam optimization.

Novelty

Rather than proposing another graph convolution operator, the paper reverses the usual design problem: it transforms graphs into multi-channel images that ordinary 2D CNNs can consume. Unlike adjacency-matrix images, the representation gives Euclidean proximity semantic meaning through node embeddings and removes node-order dependence through aggregation. Its novelty is therefore a practical structural interface between graph representation learning and conventional computer vision.

Limitations

  • Adjacent PCA dimensions are an arbitrary slicing choice and may discard informative cross-dimension interactions. Node representations also inherit node2vec stochasticity, hyperparameter sensitivity, and instability on very small graphs.
  • Resolution, channel count, and coordinate ranges require dataset-specific tuning. On COLLAB, the method reached 71.33%, substantially below the WL kernel’s 77.82%, indicating that compressed histograms can lose important global structure.
  • Count histograms omit node identity and fine-grained edge arrangement, and the paper does not systematically evaluate transfer across datasets, directed or weighted graphs, or richer edge attributes.

Future Work

Future research could learn projections and adaptive bins instead of relying on fixed PCA slices, and combine multi-plane statistics with attention or self-supervised embeddings. Extensions should cover directed, weighted, temporal, and edge-attributed graphs. Careful studies of representation stability, resolution sensitivity, scale leakage, and cross-dataset generalization are also needed.

AI Executive Summary

Graph classification asks whether an entire network belongs to a particular category—for example, whether a molecular interaction graph has a biological function or what kind of community a social network represents. Graph kernels have long dominated this task, comparing random walks, shortest paths, graphlets, or Weisfeiler–Lehman subtrees. Yet they require a dataset-wide kernel matrix, with pairwise costs growing rapidly, and their features are usually fixed before classification. They can also fragment global organization into independent local substructures.

Tixier and colleagues propose an inverse strategy: instead of inventing another graph convolution, they turn each graph into an image-like tensor for a standard 2D CNN. Nodes are first mapped into Euclidean space using spectral embeddings or node2vec. PCA aligns and compresses these representations, after which pairs of principal-component axes are binned into two-dimensional count histograms. The histograms become channels of a LeNet-5-inspired CNN. In PROTEINS full, 29-dimensional continuous node attributes are compressed and appended as additional channels.

The method reached 89.12% on REDDIT-B, 52.11% on REDDIT-5K, 48.13% on REDDIT-12K, and 77.12% on PROTEINS full. On REDDIT-12K, it exceeded the best competitor by 6.81 percentage points; on synthetic graphs, it achieved 99.08%±3.21. Runtime was also attractive: one CNN epoch took about 52 seconds on REDDIT-12K, compared with roughly 20,392 seconds for kernel computation. The approach was close to the leaders on IMDB-B but lost to the WL kernel on COLLAB, showing that fixed two-dimensional statistics can still discard global relational detail.

Deep Analysis

Background

Graphs represent molecules, social systems, documents, and interaction networks. Classical approaches include random-walk, shortest-path, graphlet, and Weisfeiler–Lehman kernels; later methods such as Deep Graph Kernels, PSCN, and DGCNN learned graph features. However, graphs lack the regular spatial grid assumed by ordinary CNNs. Adjacency or Laplacian matrices do not guarantee that nearby matrix entries are semantically nearby.

Core Problem

The task is to map variable-size, unordered graphs into fixed-size inputs while retaining local and global information. Kernels require roughly N(N−1)/2 graph comparisons; for shortest-path kernels, comparing two graphs costs O(|V1|²|V2|²). Their feature construction and classifier training are also separate, limiting task-specific representation learning.

Innovation

  • ��Use spectral embeddings or node2vec to create a Euclidean node space. •Apply PCA to align stochastic embedding dimensions and compress information. •Convert pairs of principal directions into count histograms and stack them as channels. •Use an unmodified-style 2D CNN rather than a specialized graph convolution. •Concatenate compressed continuous attributes as additional channels, creating a unified topology–attribute interface.

Methodology

  • ��Input: G=(V,E), optionally with node attributes. •Embedding: synthetic experiments use leading adjacency eigenvectors; real datasets use node2vec, with p and q controlling local versus exploratory walks. •Alignment: PCA is applied to embeddings and attributes, followed by range normalization. •Image construction: each pair of PCA coordinates forms a plane; fixed-resolution bins store the number of nodes in each cell. •Classification: parallel Conv-Pool branches use region sizes 3, 4, 5, and 6, 64/96 filters, ReLU, dropout, a 128-unit dense layer, and softmax. Adam minimizes categorical cross-entropy.

Experiments

Datasets are IMDB-B, COLLAB, REDDIT-B, REDDIT-5K, REDDIT-12K, and PROTEINS full; the latter supplies 29-dimensional continuous node attributes. Baselines include Graphlet, WL, Deep GK, PSCN, DGCNN, HGK-SP, HGK-WL, GIK, GraphHopper, PROP-diff, and PROP-WL. Experiments use 10-fold cross-validation repeated three times. CNN settings include batch size 32, dropout 0.3, Xavier initialization, Adam, and early stopping. Resolutions 9:1 and 14:1, and channel counts 2 and 5, were explored.

Results

The model achieved 89.12% on REDDIT-B, versus 78.52% for WL and 86.30% for PSCN; on REDDIT-12K it reached 48.13%, 6.81 points above the best baseline. On PROTEINS full, 77.12% exceeded DGCNN’s 75.54%; using embeddings alone reduced performance to 73.43, confirming the value of attributes. On COLLAB, WL reached 77.82% versus 71.33%. Replacing raw counts with normalized densities or KDE degraded results, and more than five channels gave no benefit.

Applications

The representation fits protein-function prediction, social-network categorization, document-relation classification, and network-security graph detection. Users need graph-level labels, computable node embeddings, and a training-set coordinate range for binning. Fixed tensors support GPU batching and moderate-scale training. The PROTEINS results particularly demonstrate that topology and continuous biological features can be learned jointly.

Limitations & Outlook

The method depends on node2vec walks and dataset-specific hyperparameters; small graphs may not support high-dimensional embeddings. Adjacent PCA slicing is not theoretically optimal. Histograms may lose exact edge arrangements, node identity, and interactions across slices, while finite resolution introduces quantization. The study focuses on undirected, unweighted graphs, and the COLLAB result shows that WL-like structural information remains important.

Plain Language Accessible to non-experts

Imagine every graph as a city and every node as a resident. Instead of looking directly at the road map, first place residents on a new map according to how similarly they behave. People who often meet, belong to the same neighborhood, or play similar roles are placed close together; unrelated people are farther apart. Then divide the map into square blocks and count how many residents occupy each block.

One map may not capture everything, so the researchers create several maps from different directions. These maps are stacked into a multi-layer “population picture.” Every city ends up with an image of the same size, whether it has dozens or thousands of residents. A normal image-recognition system can then learn patterns: one kind of city may show two dense clusters, while another may look widely scattered.

This is useful because it is fast and flexible. The system does not need to compare every city with every other city, and extra information—such as biological properties attached to residents—can be added as more map layers. But road details are partly lost when the city is reduced to block counts. If exact road layout matters, a specialized network method may still outperform this heat-map-like summary.

ELI14 Explained like you're 14

Suppose you must sort lots of social-media groups into categories: classroom teams, fan clubs, random friend circles, and so on. Each network has a different number of people, and there is no universal “person number one,” so you cannot simply treat it like a normal photo.

The researchers first give everyone a seat. People who often interact, belong to the same circle, or play similar roles sit near one another. Then they draw a floor grid and count how many people are in each square. They repeat this from several viewpoints and stack the resulting maps together. That stack becomes a “network picture.”

Now a regular 2D CNN—the kind of model often used for recognizing handwritten digits—can search for visual patterns. Maybe one group type creates two crowded regions, while another spreads people everywhere. The model does not need to memorize names, so networks of different sizes can still become equally shaped inputs. On synthetic graphs, it classified categories with 99.08% accuracy, and it reached 89.12% on REDDIT-B.

But it is not magic! Turning roads and friendships into square counts removes some details. On COLLAB, the WL method scored 77.82%, while this approach scored 71.33%. So think of the method as a useful city heat map, not a complete navigation system: it is quick and easy to train, but tasks depending on exact connections may need a more specialized tool.

Glossary

Node2vec

A node-embedding algorithm that maps nodes to vectors whose distances reflect network similarity. It trains Skip-Gram on biased random walks and can balance community similarity with structural equivalence.

It provides the main real-world node representations before PCA and histogram construction.

Principal Component Analysis (PCA)

A linear transformation that rotates variables into directions ordered by explained variance. It aligns stochastic embedding dimensions and compresses them.

It makes embeddings comparable across graphs and reduces CNN channels.

Two-dimensional histogram

A grid over a plane in which each cell stores the number of observations falling inside it. In this paper, cells act like pixels and observations are nodes.

It converts embedding coordinates into CNN-compatible channels.

Weisfeiler–Lehman kernel

A graph kernel that repeatedly aggregates neighbor labels and compares resulting label distributions. It is particularly effective for local subtree patterns.

It is a strong baseline and reaches 77.82% on COLLAB.

Graph kernel

A similarity function between graphs based on shared substructures, followed by a kernel classifier such as an SVM. Its computation commonly grows quickly with dataset and graph size.

It is the traditional paradigm the proposed method seeks to simplify and accelerate.

DGCNN and PSCN

Specialized graph neural models that respectively use learned graph-level node orderings or graph convolutional receptive fields. They adapt CNN ideas to irregular structures.

They serve as graph-CNN comparison methods.

Open Questions Unanswered questions from this research

  • 1 It remains unclear whether adjacent PCA dimensions are the best planes. Learned projections, cross-dimension statistics, or attention could preserve information lost by fixed slicing.
  • 2 The study does not establish robustness on directed, weighted, temporal, edge-attributed, or cross-dataset transfer settings.
  • 3 Absolute counts exploit graph-size differences but may create dataset shortcuts. Future work should separate genuine structural evidence from scale-based cues.

Applications

Immediate Applications

Protein-function classification

Bioinformatics teams can embed protein interaction graphs with node2vec and add 29-dimensional node attributes as extra channels. The 77.12% PROTEINS full accuracy shows that topology and continuous biological information can be learned through one CNN pipeline.

Social-network categorization

Platforms can transform user-interaction graphs into fixed tensors for community or network-type prediction. The 89.12% REDDIT-B result suggests a practical alternative to expensive graph-kernel matrices, with standard GPU mini-batch training.

Long-term Vision

A general graph-to-vision interface

A future preprocessing layer could let standard vision architectures process transportation, communication, finance, and knowledge graphs. The main obstacles are temporal change, edge attributes, and preserving fine-grained relational structure.

Abstract

Graph learning is currently dominated by graph kernels, which, while powerful, suffer some significant limitations. Convolutional Neural Networks (CNNs) offer a very appealing alternative, but processing graphs with CNNs is not trivial. To address this challenge, many sophisticated extensions of CNNs have recently been introduced. In this paper, we reverse the problem: rather than proposing yet another graph CNN model, we introduce a novel way to represent graphs as multi-channel image-like structures that allows them to be handled by vanilla 2D CNNs. Experiments reveal that our method is more accurate than state-of-the-art graph kernels and graph CNNs on 4 out of 6 real-world datasets (with and without continuous node attributes), and close elsewhere. Our approach is also preferable to graph kernels in terms of time complexity. Code and data are publicly available.

cs.CV