SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2501.03113 · ICML · 2025

Balancing Efficiency and Expressiveness: Subgraph GNNs with Walk-Based Centrality

Michael Bronstein, Haggai Maron, Fabrizio Frasca, Joshua Southern, Guy Bar-Shalom, Yam Eitan

arXiv · PDF · Open in the Atlas

Code that ran

7 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 3 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2501.03113.json · badge: /api/ran/2501.03113.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
jks17/hymn canonical (classifier label)
classifier basis: classifier_2025
7 ran · 3 no recorded run
FunctionStatusWhere it lives
ColourCatDSSGINConv Ran
ran on a synthesized input
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("c57187cb97e16c5e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch_geometric.nn import GINConv as PyGINConv

# Helper function for reset
def reset(module):
    if hasattr(module, 'reset_parameters'):
        module.reset_parameters()
    for child in module.children():
        reset(child)

# Define all the helper classes first
class Reshaper(torch.nn.Module):
    def __init__(self, num_feats, num_samples, out=False, stacked_samples=True):
        super(Reshaper, self).__init__()
        self.out = out
        self.num_feats = num_feats
        self.num_samples = num_samples
        self.stacked_samples = stacked_samples

    def reset_parameters(self):
        return

    def forward(self, x):
        if self.stacked_samples:
            if self.out:
                assert x.shape[0] % self.num_samples == 0
                num_nodes = int(x.shape[0] / self.num_samples)
                return x.reshape(num_nodes, self.num_samples * self.num_feats)
            else:
                num_nodes = x.shape[0]
                return x.reshape(num_nodes * self.num_samples, self.num_feats)
        elif self.out:
            return x.reshape(-1, self.num_samples * self.num_feats)
        else:
            return x.reshape(-1, self.num_samples, self.num_feats)

class SharedMLP(torch.nn.Module):
    def __init__(self, in_dim, emb_dim, num_samples, multiplier=1, bn=True):
        super(SharedMLP, self).__init__()
        self.mlp = torch.nn.Sequential(
            torch.nn.Linear(in_dim, multiplier * emb_dim),
            torch.nn.BatchNorm1d(multiplier * emb_dim) if bn else torch.nn.Identity(),
            torch.nn.ReLU(),
            torch.nn.Linear(multiplier * emb_dim, emb_dim)
        )
        self.in_resh = Reshaper(in_dim, num_samples, out=False, stacked_samples=True)
        self.out_resh = Reshaper(emb_dim, num_samples, out=True, stacked_samples=True)
        self.layers = torch.nn.Sequential(self.in_resh, self.mlp, self.out_resh)

    def reset_parameters(self):
        reset(self.layers)

    def forward(self, x):
        return self.layers(x)

class ColourCatter(torch.nn.Module):
    def __init__(self, num_feats, num_colours, num_samples, out_reshape=True):
        super(ColourCatter, self).__init__()
        self.feat_resh = Reshaper(num_feats, num_samples, out=False, stacked_samples=False)
        self.colour_resh = Reshaper(num_colours, num_samples, out=False, stacked_samples=False)
        self.out_resh = None
        if out_reshape:
            self.out_resh = Reshaper(num_feats + num_colours, num_samples, out=True, stacked_samples=False)

    def reset_parameters(self):
        self.feat_resh.reset_parameters()
        self.colour_resh.reset_parameters()
        if self.out_resh is not None:
            self.out_resh.reset_parameters()

    def forward(self, x, c):
        x = self.feat_resh(x)
        c = self.colour_resh(c)
        h = torch.cat([x, c], dim=2)
        if self.out_resh is not None:
            h = self.out_resh(h)
        return h

class ColourCatSharedGINConv(torch.nn.Module):
    def __init__(self, in_dim, emb_dim, colour_dim, num_samples, multiplier=1, bn=True):
        super(ColourCatSharedGINConv, self).__init__()
        self.colour_catter = ColourCatter(in_dim, colour_dim, num_samples, out_reshape=True)
        mlp = SharedMLP(in_dim + colour_dim, emb_dim, num_samples, multiplier=multiplier, bn=bn)
        self.layer = PyGINConv(nn=mlp, train_eps=True)

    def reset_parameters(self):
        self.colour_catter.reset_parameters()
        self.layer.reset_parameters()

    def forward(self, x, edge_index, c, edge_attr=None):
        assert x.shape[0] == c.shape[0]
        h = self.colour_catter(x, c)
        return self.layer(h, edge_index)

# Setup code
INIT_ARGS = {
    'in_dim': 4,
    'emb_dim': 6,
    'colour_dim': 3,
    'num_samples': 2,
    'multiplier': 2,
    'bn': True
}

# Create input tensors for forward pass
# x: node features [num_nodes, in_dim * num_samples] (flattened for num_samples)
# c: colour features [num_nodes, colour_dim * num_samples] (flattened for num_samples)
# edge_index: graph connectivity [2, num_edges]
num_nodes = 5
num_edges = 8

x = torch.randn(num_nodes, INIT_ARGS['in_dim'] * INIT_ARGS['num_samples'])
c = torch.randn(num_nodes, INIT_ARGS['colour_dim'] * INIT_ARGS['num_samples'])
edge_index = torch.tensor([[0, 1, 1, 2, 2, 3, 3, 4],
                           [1, 0, 2, 1, 3, 2, 4, 3]], dtype=torch.long)

ARGS = {
    'x': x,
    'edge_index': edge_index,
    'c': c,
    'edge_attr': None
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ColourCatter Ran
ran on a synthesized input · constructed an object; no result was computed
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("5b5c7579b1634837")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, ColourCatter: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "num_feats": 4,
    "num_colours": 3,
    "num_samples": 2,
    "out_reshape": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ColourCatter — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ColourCatter output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DSSGINConv Ran
ran on a synthesized input · constructed an object; no result was computed
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("33fc84111dcbbf84")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, DSSGINConv: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch_geometric.nn import GINConv as PyGINConv

torch.manual_seed(0)

# Create minimal test data
# x: node features with shape (num_nodes, in_dim)
# For DSSGINConv.forward, x gets reshaped with in_resh which expects
# (num_nodes * num_samples, in_dim) when out=False, stacked_samples=False
# So we need x with shape (num_nodes * num_samples, in_dim)
num_nodes = 2
num_samples = 3
in_dim = 4
emb_dim = 5

# x should be (num_nodes * num_samples, in_dim) = (6, 4)
x = torch.randn(num_nodes * num_samples, in_dim)

# edge_index: standard PyG format (2, num_edges)
# edges connect nodes in range [0, num_nodes * num_samples)
edge_index = torch.tensor([
    [0, 1, 2, 3],
    [1, 2, 3, 4]
], dtype=torch.long)

ARGS = {
    'in_dim': in_dim,
    'emb_dim': emb_dim,
    'num_samples': num_samples,
    'multiplier': 1,
    'bn': True,
    'aggregation': 'mean'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DSSGINConv — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DSSGINConv output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
GINConv Ran
ran on a synthesized input · constructed an object; no result was computed
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("7e9bf75a0899a21a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, GINConv: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch_geometric.nn import GINConv as PyGINConv

torch.manual_seed(0)

# Create sample data for forward pass
batch_size = 2
in_dim = 4
emb_dim = 3
num_nodes = 2
num_edges = 2

# Node features: [num_nodes, in_dim]
x = torch.randn(num_nodes, in_dim)

# Edge index: [2, num_edges]
edge_index = torch.tensor([[0, 1], [1, 0]], dtype=torch.long)

# Optional edge attributes (not used in forward, but included for completeness)
edge_attr = None

ARGS = {
    'in_dim': in_dim,
    'emb_dim': emb_dim,
    'multiplier': 1,
    'bn': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GINConv — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a GINConv output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Reshaper Ran
ran on a synthesized input · constructed an object; no result was computed
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("4c18c3efbf6a15cf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Reshaper: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Test case 1: stacked_samples=True, out=False
# Input: (num_nodes, num_feats)
# Output: (num_nodes * num_samples, num_feats)
num_feats_1 = 3
num_samples_1 = 2
x_1 = torch.randn(4, num_feats_1)  # 4 nodes, 3 features

# Test case 2: stacked_samples=True, out=True
# Input: (num_nodes * num_samples, num_feats)
# Output: (num_nodes, num_samples * num_feats)
num_feats_2 = 3
num_samples_2 = 2
x_2 = torch.randn(8, num_feats_2)  # 8 = 4 nodes * 2 samples, 3 features

# Test case 3: stacked_samples=False, out=False
# Input: (batch, num_feats)
# Output: (batch, num_samples, num_feats)
num_feats_3 = 3
num_samples_3 = 2
x_3 = torch.randn(4, num_feats_3)

# Test case 4: stacked_samples=False, out=True
# Input: (batch, num_samples, num_feats)
# Output: (batch, num_samples * num_feats)
num_feats_4 = 3
num_samples_4 = 2
x_4 = torch.randn(4, num_samples_4, num_feats_4)

ARGS = {
    "num_feats": 3,
    "num_samples": 2,
    "out": False,
    "stacked_samples": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Reshaper — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Reshaper output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SharedGINConv Ran
ran on a synthesized input · constructed an object; no result was computed
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("6d2abd2ccec09cfb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SharedGINConv: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
torch.manual_seed(0)

# Create minimal tensors for testing
# x: node features with stacked samples
# For SharedGINConv, x will be passed through SharedMLP which reshapes it
# num_nodes=2, num_samples=3, in_dim=4
# So x should have shape (num_nodes * num_samples, in_dim) = (6, 4)
x = torch.randn(6, 4)

# edge_index: standard PyG format [2, num_edges]
# Create a simple graph with 2 nodes, a few edges
edge_index = torch.tensor([[0, 1, 0, 1], [1, 0, 0, 1]], dtype=torch.long)

# Parameters for SharedGINConv.__init__
in_dim = 4
emb_dim = 3
num_samples = 3
multiplier = 1
bn = True

ARGS = {
    "in_dim": in_dim,
    "emb_dim": emb_dim,
    "num_samples": num_samples,
    "multiplier": multiplier,
    "bn": bn,
}

# Create an instance and test the forward pass
model = torch.nn.Module()
# We need to test with the actual model
shared_gin = torch.nn.Module.__new__(type('SharedGINConv', (torch.nn.Module,), {
    '__init__': lambda self, in_dim, emb_dim, num_samples, multiplier=1, bn=True: (
        super(type(self), self).__init__(),
        setattr(self, 'layer', PyGINConv(
            nn=SharedMLP(in_dim, emb_dim, num_samples, multiplier=multiplier, bn=bn),
            train_eps=True
        ))
    ),
    'reset_parameters': lambda self: self.layer.reset_parameters(),
    'forward': lambda self, x, edge_index, edge_attr=None: self.layer(x, edge_index),
}))
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SharedGINConv — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SharedGINConv output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SharedMLP Ran
ran on a synthesized input · constructed an object; no result was computed
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("92ad417437775dff")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SharedMLP: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Define the ARGS dictionary with all parameters for SharedMLP
ARGS = {
    "in_dim": 4,
    "emb_dim": 8,
    "num_samples": 2,
    "multiplier": 2,
    "bn": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SharedMLP — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SharedMLP output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
ColourCatSharedGINConv Not yet run
unverified (harvested, no recorded run)
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("c34bffdf7e8e7f53")
How it ran

no invocation recorded.

ColourCatSharedGNN Not yet run
unverified (harvested, no recorded run)
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("aa2c80a08c0f2ec3")
How it ran

no invocation recorded.

reset Not yet run
unverified (harvested, no recorded run)
jks17/hymn/counting_substructures/model.py
code served (permissive licence) · get_code("5523506924b65182")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 10 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Subgraph GNNs have emerged as promising architectures that overcome the expressiveness limitations of Graph Neural Networks (GNNs) by processing bags of subgraphs. Despite their compelling empirical performance, these methods are afflicted by a high computational complexity: they process bags whose size grows linearly in the number of nodes, hindering their applicability to larger graphs. In this work, we propose an effective and easy-to-implement approach to dramatically alleviate the computational cost of Subgraph GNNs and unleash broader applications thereof. Our method, dubbed HyMN, leverages walk-based centrality measures to sample a small number of relevant subgraphs and drastically reduce the bag size. By drawing a connection to perturbation analysis, we highlight the strength of the proposed centrality-based subgraph sampling, and further prove that these walk-based centralities can be additionally used as Structural Encodings for improved discriminative power. A comprehensive set of experimental results demonstrates that HyMN provides an effective synthesis of expressiveness, efficiency, and downstream performance, unlocking the application of Subgraph GNNs to dramatically larger graphs. Not only does our method outperform more sophisticated subgraph sampling approaches, it is also competitive, and sometimes better, than other state-of-theart approaches for a fraction of their runtime.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2501.03113")
get_code_for_paper("2501.03113")
have("2501.03113")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2501.03113.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2501.03113.svg)](https://syntology.ai/paper/2501.03113)

Connect an agent — have() is free.