SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.01092 · ICML · 2024

Pairwise Alignment Improves Graph Domain Adaptation

Han Zhao, Pan Li, Shikun Liu, Deyu Zou

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 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; 5 failures of our instrument; 0 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/2403.01092.json · badge: /api/ran/2403.01092.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
graph-com/pair-align canonical (classifier label)
classifier basis: classifier_2025
5 ran · 0 no recorded run
FunctionStatusWhere it lives
LS_optimization Ran
ran; our contract draft was wrong, not the code
graph-com/pair-align/src/calc_rw.py
code served (permissive licence) · get_code("ebef98525e89e8a8")
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 torch
import numpy as np

torch.manual_seed(0)

# The function expects:
# - cov: a tensor with shape (n, n) that will be converted to numpy
# - muhat_tgt: a tensor with shape (n,) that will be reshaped and converted to numpy
# - mu_src: a tensor with shape (n,) that will be reshaped and converted to numpy
# - lambda_reg: a scalar (float)

# Create small test tensors
n = 4

# Create a covariance matrix (4x4, symmetric positive semi-definite)
cov_np = np.random.randn(n, n)
cov_np = cov_np @ cov_np.T  # Make it symmetric positive semi-definite
cov = torch.from_numpy(cov_np).float()

# Create muhat_tgt (target mean estimate, shape 4)
muhat_tgt = torch.randn(n).float()

# Create mu_src (source mean, shape 4)
mu_src = torch.randn(n).float()

# Ensure mu_src @ x can equal 1 by making it non-zero
mu_src = mu_src + 1.0

# Lambda regularization parameter
lambda_reg = 0.1

ARGS = {
    "cov": cov,
    "muhat_tgt": muhat_tgt,
    "mu_src": mu_src,
    "lambda_reg": lambda_reg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cvxpy, numpy, torch — 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
calc_edge_rw_pseudo Ran
ran; our contract draft was wrong, not the code
graph-com/pair-align/src/calc_rw.py
code served (permissive licence) · get_code("56cbdcee85eb33d7")
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 tuple, ndim 1, 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 numpy as np

torch.manual_seed(0)

class MockGraph:
    def __init__(self, num_nodes, num_edges, num_classes):
        self.num_nodes = num_nodes
        self.num_edges = num_edges
        self.num_classes = num_classes
        self.edge_index = (np.random.randint(0, num_nodes, num_edges), 
                          np.random.randint(0, num_nodes, num_edges))
        self.edge_class = np.random.randint(0, 2, (num_edges, num_classes ** 2))
        self.true_ew = np.random.rand(num_classes, num_classes)
        self.true_beta = np.random.rand(num_classes, num_classes)
        self.edge_weight = None
        self.ew = None

class MockArgs:
    def __init__(self):
        self.ls_lambda = 0.1
        self.gamma_reg = 1e-6

num_nodes_src = 5
num_edges_src = 8
num_nodes_tgt = 6
num_edges_tgt = 10
num_classes = 2

src_graph = MockGraph(num_nodes_src, num_edges_src, num_classes)
tgt_graph = MockGraph(num_nodes_tgt, num_edges_tgt, num_classes)

yhat_src = torch.randn(num_nodes_src, num_classes, dtype=torch.float32)
yhat_tgt = torch.randn(num_nodes_tgt, num_classes, dtype=torch.float32)

device = torch.device('cpu')
args = MockArgs()

ARGS = {
    'src_graph': src_graph,
    'tgt_graph': tgt_graph,
    'yhat_src': yhat_src,
    'yhat_tgt': yhat_tgt,
    'device': device,
    'args': args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
cvxpy, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — 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
calc_ratio_weight Ran
ran; our contract draft was wrong, not the code
graph-com/pair-align/src/calc_rw.py
code served (permissive licence) · get_code("3314a8dc8f22a69d")
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 numpy as np

class MockGraph:
    def __init__(self, num_edges, num_classes):
        self.num_edges = num_edges
        self.num_classes = num_classes
        # edge_class should be reshaped to (num_edges, num_classes**2)
        # So it needs num_edges * num_classes**2 elements total
        self.edge_class = np.random.rand(num_edges * num_classes ** 2)

# Set up parameters
num_edges = 10
num_classes = 3

src_graph = MockGraph(num_edges, num_classes)
kmm_weight = np.random.rand(num_classes ** 2)
gamma_reg = 0.01

ARGS = {
    "src_graph": src_graph,
    "kmm_weight": kmm_weight,
    "gamma_reg": gamma_reg
}
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 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
edgeidx_to_adj Ran
ran; our contract draft was wrong, not the code
graph-com/pair-align/data_process/pre_datasets.py
code served (permissive licence) · get_code("9e480bc71d643ce7")
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 csr_matrix. 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 numpy as np
import scipy.sparse as sp

# Create small edge lists for a graph with 5 nodes
edge_source = np.array([0, 1, 2, 3, 1], dtype=np.int32)
edge_target = np.array([1, 2, 3, 4, 0], dtype=np.int32)
num_node = 5

ARGS = {
    "edge_source": edge_source,
    "edge_target": edge_target,
    "num_node": num_node,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type csr_matrix — a csr_matrix output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a csr_matrix 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
edges_to_adj Ran
ran; our contract draft was wrong, not the code
graph-com/pair-align/data_process/pre_datasets.py
code served (permissive licence) · get_code("b303d995f3e0d28e")
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 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 numpy as np
import torch
import scipy.sparse as sp

torch.manual_seed(0)

# Create a small set of edges
# edges should be a list of tuples/lists where each element is [source, target]
edges = [
    [0, 1],
    [1, 2],
    [2, 0],
    [1, 3],
]

# Number of nodes in the graph
num_node = 4

ARGS = {
    "edges": edges,
    "num_node": num_node,
}
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 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

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 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 (1 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
edges_to_adj 3 other papers
2 dated earlier, 1 later
2306.03221 (2023-06)
Structural Re-weighting Improves Graph Domain Adaptation
2402.08907 (2024-02)
Subgraph Pooling: Tackling Negative Transfer on Graphs
2407.11052 (2024-07)
Revisiting, Benchmarking and Understanding Unsupervised Graph Domain Adaptation
LS_optimization
brick of this paper's assembly: helper
1 other paper
1 later
2407.11052 (2024-07)
Revisiting, Benchmarking and Understanding Unsupervised Graph Domain Adaptation
calc_edge_rw_pseudo
brick of this paper's assembly: entry
1 other paper
1 later
2407.11052 (2024-07)
Revisiting, Benchmarking and Understanding Unsupervised Graph Domain Adaptation
calc_ratio_weight
brick of this paper's assembly: helper
1 other paper
1 later
2407.11052 (2024-07)
Revisiting, Benchmarking and Understanding Unsupervised Graph Domain Adaptation
edgeidx_to_adj 1 other paper
1 later
2407.11052 (2024-07)
Revisiting, Benchmarking and Understanding Unsupervised Graph Domain Adaptation

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

Graph-based methods, pivotal for label inference over interconnected objects in many real-world applications, often encounter generalization challenges, if the graph used for model training differs significantly from the graph used for testing. This work delves into Graph Domain Adaptation (GDA) to address the unique complexities of distribution shifts over graph data, where interconnected data points experience shifts in features, labels, and in particular, connecting patterns. We propose a novel, theoretically principled method, Pairwise Alignment (Pair-Align) to counter graph structure shift by mitigating conditional structure shift (CSS) and label shift (LS). Pair-Align uses edge weights to recalibrate the influence among neighboring nodes to handle CSS and adjusts the classification loss with label weights to handle LS. Our method demonstrates superior performance in real-world applications, including node classification with region shift in social networks, and the pileup mitigation task in particle colliding experiments. For the first application, we also curate the largest dataset by far for GDA studies. Our method shows strong performance in synthetic and other existing benchmark datasets. 1

For agents

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

get_harvested_code_for_paper("2403.01092")
get_code_for_paper("2403.01092")
have("2403.01092")

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

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

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

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

Connect an agent — have() is free.