SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.04891 · ICLR · 2025

GNNs Getting ComFy: Community and Feature Similarity Guided Rewiring

Rebekka Burkholz, Adarsh Jamadandi, Celia Rubio-Madrigal, Feast Del

arXiv · PDF · Open in the Atlas

Code that ran

4 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 0 failures of our instrument; 7 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/2502.04891.json · badge: /api/ran/2502.04891.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
RelationalML/ComFy canonical (classifier label)
classifier basis not recorded on the link
4 ran · 7 no recorded run
FunctionStatusWhere it lives
convert_labels_to_consecutive_integers Ran
ran on a synthesized input
RelationalML/ComFy/Comm+Sim/nodeli.py
code served (permissive licence) · get_code("f9f42b8b5fc8871f")
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 ndarray, ndim 1, dtype family int, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np

# Test case 1: numpy array with string labels
labels_array = np.array(['cat', 'dog', 'cat', 'bird', 'dog'])
ARGS = {
    'labels': labels_array
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family int, shape (5,) — shape (5,) as a later run recorded it
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: none by the harness; any seed is in the setup block
get_graph_and_labels_from_pyg_dataset Ran
ran on a synthesized input
RelationalML/ComFy/Comm+Sim/nodeli.py
code served (permissive licence) · get_code("8a42ddb4c2e9ada3")
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 tuple, ndim 2, dtype family int; 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 networkx as nx

torch.manual_seed(0)

class MockPyGDataset:
    def __init__(self):
        # x: node features, shape (num_nodes, num_features)
        self.x = torch.randn(2, 4)
        # edge_index: shape (2, num_edges) - COO format edges
        self.edge_index = torch.tensor([[0, 1], [1, 0]], dtype=torch.long)
        # y: labels, shape (num_nodes,)
        self.y = torch.tensor([0, 1], dtype=torch.long)

dataset = MockPyGDataset()

ARGS = {
    "dataset": dataset
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family int — a tuple output has no array shape of its own; none is stated
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: none by the harness; any seed is in the setup block
make_labels_hashable Ran
ran on a synthesized input
RelationalML/ComFy/Comm+Sim/nodeli.py
code served (permissive licence) · get_code("26fc619ec8678aa9")
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 ndarray, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np

# Test case 1: numpy array labels
labels_array = np.array(['a', 'b', 'c', 'd'])

# Test case 2: dict with string labels
labels_dict_simple = {'node1': 'label1', 'node2': 'label2', 'node3': 'label3'}

# Test case 3: dict with nested dict values
labels_dict_nested = {
    'node1': {'sublabel': 'value1'},
    'node2': {'sublabel': 'value2'}
}

# Test case 4: dict with list values
labels_dict_lists = {
    'node1': [1, 2, 3],
    'node2': [4, 5, 6]
}

# Test case 5: dict with numpy array values
labels_dict_arrays = {
    'node1': np.array([1, 2, 3]),
    'node2': np.array([4, 5, 6])
}

# Test case 6: plain list (should pass through unchanged)
labels_list = ['a', 'b', 'c']

# Use the numpy array case as the primary test
ARGS = {
    'labels': labels_array
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
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: none by the harness; any seed is in the setup block
proxydelmax Ran
ran on a synthesized input
RelationalML/ComFy/Spectral/methods.py
code served (permissive licence) · get_code("fe1befd93025f18b")
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 tuple. 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 networkx as nx
from torch_geometric.data import Data
import numpy as np

torch.manual_seed(0)

# Create a small stand-in class for functions that are called but not defined
class StandIn:
    def __call__(self, *args, **kwargs):
        return None

# Mock the missing functions
def maximize_modularity(graph):
    """Mock function that returns a list of clusters (each cluster is a list of nodes)"""
    nodes = list(graph.nodes())
    if len(nodes) == 0:
        return []
    # Simple mock: return each node in its own cluster
    return [[node] for node in nodes]

def rank_by_proxy_delete(*args, **kwargs):
    """Mock ranking function"""
    return []

def process_and_update_edges(graph, rank_func, strategy, seed, max_iter, updating_period):
    """Mock function that processes and updates edges"""
    # Return a copy of the graph with minimal changes
    return graph.copy()

def spectral_gap(graph):
    """Mock function that returns spectral gap"""
    return (0.5, 0.0, 0.0, 0.0)

# Patch these into the global namespace for the function to use
import sys
current_module = sys.modules[__name__]
setattr(current_module, 'maximize_modularity', maximize_modularity)
setattr(current_module, 'rank_by_proxy_delete', rank_by_proxy_delete)
setattr(current_module, 'process_and_update_edges', process_and_update_edges)
setattr(current_module, 'spectral_gap', spectral_gap)

# Create a small graph with 5 nodes
nxgraph = nx.Graph()
nxgraph.add_edges_from([(0, 1), (1, 2), (2, 3), (3, 4), (0, 2)])

# Create a small PyG Data object
x = torch.randn(5, 4)  # 5 nodes, 4 features
y = torch.tensor([0, 0, 1, 1, 2])  # 5 nodes with 3 classes
edge_index = torch.tensor([[0, 1, 1, 2, 2, 3, 3, 4, 0, 2],
                           [1, 0, 2, 1, 3, 2, 4, 3, 2, 0]], dtype=torch.long)
data = Data(x=x, y=y, edge_index=edge_index)

# Define the ARGS dictionary
ARGS = {
    'data': data,
    'nxgraph': nxgraph,
    'seed': 42,
    'max_iterations': 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy, sklearn, torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
load_data Not yet run
unverified (harvested, no recorded run)
RelationalML/ComFy/Comm+Sim/dataloader.py
code served (permissive licence) · get_code("50cb189b5c97597b")
How it ran

no invocation recorded.

load_data Not yet run
unverified (harvested, no recorded run)
RelationalML/ComFy/CommunityRewiring/dataloader.py
code served (permissive licence) · get_code("8402cd79e63ca15b")
How it ran

no invocation recorded.

proxyaddmax Not yet run
unverified (harvested, no recorded run)
RelationalML/ComFy/Comm+Sim/methods.py
code served (permissive licence) · get_code("2abb6906606a7567")
How it ran

no invocation recorded.

proxyaddmax Not yet run
unverified (harvested, no recorded run)
RelationalML/ComFy/Spectral/methods.py
code served (permissive licence) · get_code("0b0dc22e984c1dbf")
How it ran

no invocation recorded.

proxydelmax Not yet run
unverified (harvested, no recorded run)
RelationalML/ComFy/Comm+Sim/methods.py
code served (permissive licence) · get_code("edde6e5c733773f9")
How it ran

no invocation recorded.

proxydelmin Not yet run
unverified (harvested, no recorded run)
RelationalML/ComFy/Comm+Sim/methods.py
code served (permissive licence) · get_code("290a39798ff9d0ce")
How it ran

no invocation recorded.

proxydelmin Not yet run
unverified (harvested, no recorded run)
RelationalML/ComFy/Spectral/methods.py
code served (permissive licence) · get_code("568fa2708cd35ca3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 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 11 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

Maximizing the spectral gap through graph rewiring has been proposed to enhance the performance of message-passing graph neural networks (GNNs) by addressing over-squashing. However, as we show, minimizing the spectral gap can also improve generalization. To explain this, we analyze how rewiring can benefit GNNs within the context of stochastic block models. Since spectral gap optimization primarily influences community strength, it improves performance when the community structure aligns with node labels. Building on this insight, we propose three distinct rewiring strategies that explicitly target community structure, node labels, and their alignment: (a) community structure-based rewiring (ComMa), a more computationally efficient alternative to spectral gap optimization that achieves similar goals; (b) feature similarity-based rewiring (FeaSt), which focuses on maximizing global homophily; and (c) a hybrid approach (ComFy), which enhances local feature similarity while preserving community structure to optimize label-community alignment. Extensive experiments confirm the effectiveness of these strategies and support our theoretical insights.

For agents

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

get_harvested_code_for_paper("2502.04891")
get_code_for_paper("2502.04891")
have("2502.04891")

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

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

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

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

Connect an agent — have() is free.