SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2009.00142 · NeurIPS · 2020

Distance Encoding: Design Provably More Powerful Neural Networks for Graph Representation Learning

Jure Leskovec, Pan Li, Yanbang Wang, Hongwei Wang

arXiv · PDF · Open in the Atlas

Code that ran

1 of 2 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 0 failures of our instrument; 1 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/2009.00142.json · badge: /api/ran/2009.00142.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
snap-stanford/distance-encoding marked official in Papers with Code
Papers with Code archive
1 ran · 0 no recorded run
JeffJeffy/CS224W-OGB-DEA-JK community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
PGNNLayer Ran
ran on a synthesized input · constructed an object; no result was computed
snap-stanford/distance-encoding/models/layers.py
code served (permissive licence) · get_code("fb14043453fcc4f0")
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, PGNNLayer: 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)

# Analyze the function usage:
# - input_dim: used in nn.Linear(input_dim * 2, output_dim)
# - output_dim: used in nn.Linear(..., output_dim) and nn.Linear(self.num_anchor_sets, output_dim)
# - prop_depth: stored as self.num_anchor_sets, used in nn.Linear(self.num_anchor_sets, output_dim)
# - act: stored and potentially called (torch.relu by default)
# - dropout: passed to nn.Dropout(p=dropout)
# - layer_i: used to index adj_batch[self.layer_i]

# In the forward/layer method:
# - x: tensor of shape (N, B, F_) where N=nodes, B=batch, F_=features
# - adj_batch: 4D tensor indexed as adj_batch[layer_i][0] and adj_batch[layer_i][1]
#   - adj_batch[layer_i][0] contains dists_max (inverse distance scores)
#   - adj_batch[layer_i][1] contains dists_argmax (indices, shape should match N, num_anchor_sets)

# Create small tensors with distinct dimensions
input_dim = 4
output_dim = 5
prop_depth = 3  # num_anchor_sets
N = 6  # num nodes
B = 2  # batch size
F_ = input_dim

# x: (N, B, F_) - nodes, batch, features
x = torch.randn(N, B, F_)

# adj_batch: 4D tensor
# Structure: adj_batch[layer_i][0] = dists_max, adj_batch[layer_i][1] = dists_argmax
# dists_max should broadcast to (B, N, prop_depth)
# dists_argmax should be (B, N, prop_depth) with indices into N dimension
dists_max = torch.rand(B, N, prop_depth)
dists_argmax = torch.randint(0, N, (B, N, prop_depth))

# adj_batch indexed by layer_i (0)
adj_batch = torch.zeros(1, 2, B, N, prop_depth)
adj_batch[0, 0] = dists_max
adj_batch[0, 1] = dists_argmax

ARGS = {
    'input_dim': input_dim,
    'output_dim': output_dim,
    'prop_depth': prop_depth,
    'act': torch.relu,
    'dropout': 0.1,
    'layer_i': 0,
}
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 PGNNLayer — 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 PGNNLayer 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
DEA_GNN_JK Not yet run
unverified (harvested, no recorded run)
JeffJeffy/CS224W-OGB-DEA-JK/dea_gcn_jk.py
pointer only (licence: NONE) · get_code("1053360aacb03ef2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, JeffJeffy/CS224W-OGB-DEA-JK when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

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

Learning representations of sets of nodes in a graph is crucial for applications ranging from node-role discovery to link prediction and molecule classification. Graph Neural Networks (GNNs) have achieved great success in graph representation learning. However, expressive power of GNNs is limited by the 1-Weisfeiler-Lehman (WL) test and thus GNNs generate identical representations for graph substructures that may in fact be very different. More powerful GNNs, proposed recently by mimicking higher-order-WL tests, only focus on representing entire graphs and they are computationally inefficient as they cannot utilize sparsity of the underlying graph. Here we propose and mathematically analyze a general class of structurerelated features, termed Distance Encoding (DE). DE assists GNNs in representing any set of nodes, while providing strictly more expressive power than the 1-WL test. DE captures the distance between the node set whose representation is to be learned and each node in the graph. To capture the distance DE can apply various graph-distance measures such as shortest path distance or generalized PageRank scores. We propose two ways for GNNs to use DEs (1) as extra node features, and (2) as controllers of message aggregation in GNNs. Both approaches can utilize the sparse structure of the underlying graph, which leads to computational efficiency and scalability. We also prove that DE can distinguish node sets embedded in almost all regular graphs where traditional GNNs always fail. We evaluate DE on three tasks over six real networks: structural role prediction, link prediction, and triangle prediction. Results show that our models outperform GNNs without DE by up-to 15% in accuracy and AUROC. Furthermore, our models also significantly outperform other state-of-the-art methods especially designed for the above tasks. Graph neural networks (GNNs), inheriting the power of neural networks [18], have become the de facto standard for representation learning in graphs [19]. Generaly, GNNs use message passing procedure over the input graph, which can be summarized in three steps: (1) Initialize node representations with their initial attributes (if given) or structural features such as node degrees; 34th Conference on Neural Information Processing Systems (NeurIPS 2020),

For agents

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

get_harvested_code_for_paper("2009.00142")
get_code_for_paper("2009.00142")
have("2009.00142")

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

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

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

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

Connect an agent — have() is free.