SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.05057 · NeurIPS · 2020

Towards More Practical Adversarial Attacks on Graph Neural Networks

Jiaqi Ma, Qiaozhu Mei

arXiv · PDF · Open in the Atlas

Code that ran

3 of 6 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 0 have no contract verdict; 3 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/2006.05057.json · badge: /api/ran/2006.05057.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
mark12ding/gnn-practical-attack canonical (classifier label)
classifier basis: classifier_2025
1 ran · 2 no recorded run
theaperdeng/gnn-attack-infmax extension (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
FunctionStatusWhere it lives
New_sort_erf_testsum Ran
ran; our contract draft was wrong, not the code
theaperdeng/gnn-attack-infmax/attack.py
code served (permissive licence) · get_code("27df709d95d0bfb7")
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) and returned list, ndim 1, 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 as th
import numpy as np

# Create a simple graph class that supports the methods used in the function
class SimpleGraph:
    def __init__(self, num_nodes, edges):
        """
        :param num_nodes: number of nodes
        :param edges: list of (source, target) tuples
        """
        self.num_nodes = num_nodes
        self.edges = edges
        # Build adjacency for out_degree and out_edges
        self.out_degree_dict = {}
        self.out_edges_dict = {}
        for i in range(num_nodes):
            self.out_degree_dict[i] = 0
            self.out_edges_dict[i] = ([], [])
        
        for src, tgt in edges:
            self.out_degree_dict[src] += 1
            self.out_edges_dict[src][1].append(tgt)
    
    def out_degree(self, node):
        return self.out_degree_dict.get(node, 0)
    
    def out_edges(self, node):
        return self.out_edges_dict.get(node, ([], []))

# Set random seed for reproducibility
th.manual_seed(0)
np.random.seed(0)

# Create parameters
num_nodes = 5
sigma = 1.5
M = np.random.randn(num_nodes, num_nodes).astype(np.float64)
limit = 3
bar = 1  # degree threshold
test_idx = [0, 2]  # indices to test

# Create a simple graph with some edges
edges = [(0, 1), (0, 2), (1, 3), (2, 3), (3, 4)]
g = SimpleGraph(num_nodes, edges)

ARGS = {
    "sigma": sigma,
    "M": M,
    "limit": limit,
    "bar": bar,
    "g": g,
    "test_idx": test_idx,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list 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
New_sort_sumtest Ran
ran; our contract draft was wrong, not the code
theaperdeng/gnn-attack-infmax/attack.py
code served (permissive licence) · get_code("b495853937d23deb")
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) and returned list, ndim 1, 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 as th
import numpy as np
from scipy.special import erf

class SimpleGraph:
    """Minimal graph class with required methods"""
    def __init__(self, num_nodes):
        self.num_nodes = num_nodes
        # Create adjacency list: node i has edges to nodes (i+1) % num_nodes
        self.edges = {i: [(i, (i + 1) % num_nodes)] for i in range(num_nodes)}
        self.out_degrees = {i: 1 for i in range(num_nodes)}
    
    def out_degree(self, node):
        """Return out-degree of a node"""
        return self.out_degrees.get(node, 0)
    
    def out_edges(self, node):
        """Return out edges as (source_list, target_list)"""
        if node in self.edges:
            sources, targets = zip(*self.edges[node])
            return (list(sources), list(targets))
        return ([], [])

# Create test data
num_nodes = 5
M = np.random.randn(num_nodes, num_nodes).astype(np.float32)
g = SimpleGraph(num_nodes)
test_idx = [0, 2]

ARGS = {
    "alpha": 10,
    "M": M,
    "limit": 3,
    "bar": 0,
    "g": g,
    "test_idx": test_idx
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list 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
getScore Ran
ran; our contract draft was wrong, not the code
mark12ding/gnn-practical-attack/attack.py
code served (permissive licence) · get_code("a37e866ddc285b70")
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) and returned Tensor. 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 as th
import numpy as np

th.manual_seed(0)

class Data:
    def __init__(self):
        # Create a small sparse probability matrix (4x4)
        # Using COO format for sparse tensor
        indices = th.tensor([[0, 1, 2, 3], [1, 2, 3, 0]], dtype=th.long)
        values = th.tensor([0.25, 0.25, 0.25, 0.25], dtype=th.float32)
        self.Prob = th.sparse_coo_tensor(indices, values, (4, 4), dtype=th.float32)

data = Data()

ARGS = {
    "K": 2,
    "data": data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, shape (4,) — shape (4,) as a later run recorded it
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
getScore Not yet run
unverified (harvested, no recorded run)
theaperdeng/gnn-attack-infmax/attack.py
code served (permissive licence) · get_code("62cc074a62020b53")
How it ran

no invocation recorded.

getScoreGreedy Not yet run
unverified (harvested, no recorded run)
mark12ding/gnn-practical-attack/attack.py
code served (permissive licence) · get_code("193746d4ee64623c")
How it ran

no invocation recorded.

getThrehold Not yet run
unverified (harvested, no recorded run)
mark12ding/gnn-practical-attack/attack.py
code served (permissive licence) · get_code("22a55a7d9807a9d2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 0 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.

FunctionAlso present inEarliest-datedOthers named
New_sort_erf_testsum 1 other paper
1 later
2106.10785 (2021-06)
Adversarial Attack on Graph Neural Networks as An Influence Maximization Problem
New_sort_sumtest 1 other paper
1 later
2106.10785 (2021-06)
Adversarial Attack on Graph Neural Networks as An Influence Maximization Problem
getScore 1 other paper
1 later
2106.10785 (2021-06)
Adversarial Attack on Graph Neural Networks as An Influence Maximization Problem
getScoreGreedy
brick of this paper's assembly: entry
1 other paper
1 later
2106.10785 (2021-06)
Adversarial Attack on Graph Neural Networks as An Influence Maximization Problem
getThrehold 1 other paper
1 later
2106.10785 (2021-06)
Adversarial Attack on Graph Neural Networks as An Influence Maximization Problem

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

We study the black-box attacks on graph neural networks (GNNs) under a novel and realistic constraint: attackers have access to only a subset of nodes in the network, and they can only attack a small number of them. A node selection step is essential under this setup. We demonstrate that the structural inductive biases of GNN models can be an effective source for this type of attacks. Specifically, by exploiting the connection between the backward propagation of GNNs and random walks, we show that the common gradient-based white-box attacks can be generalized to the black-box setting via the connection between the gradient and an importance score similar to PageRank. In practice, we find attacks based on this importance score indeed increase the classification loss by a large margin, but they fail to significantly increase the mis-classification rate. Our theoretical and empirical analyses suggest that there is a discrepancy between the loss and mis-classification rate, as the latter presents a diminishing-return pattern when the number of attacked nodes increases. Therefore, we propose a greedy procedure to correct the importance score that takes into account of the diminishing-return pattern. Experimental results show that the proposed procedure can significantly increase the mis-classification rate of common GNNs on real-world data without access to model parameters nor predictions 4 .

For agents

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

get_harvested_code_for_paper("2006.05057")
get_code_for_paper("2006.05057")
have("2006.05057")

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

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

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

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

Connect an agent — have() is free.