Skip to main content

PyPI - Version Documentation Status License: MIT contributions welcome

PyGDA is a Python library for Graph Domain Adaptation built upon PyTorch and PyG to easily train graph domain adaptation models in a sklearn style. PyGDA includes 20+ graph domain adaptation models. See examples with PyGDA below!

Graph Domain Adaptation Using PyGDA with 5 Lines of Code

from pygda.models import A2GNN

# choose a graph domain adaptation model
model = A2GNN(in_dim=num_features, hid_dim=args.nhid, num_classes=num_classes, device=args.device)

# train the model
model.fit(source_data, target_data)

# evaluate the performance
logits, labels = model.predict(target_data)

PyGDA is featured for:

  • Consistent APIs and comprehensive documentation.
  • Cover 20+ graph domain adaptation models.
  • Scalable architecture that efficiently handles large graph datasets through mini-batching and sampling techniques.
  • Seamlessly integrated data processing with PyG, ensuring full compatibility with PyG data structures.

📢 What's New?

[11/2026]. We have added source-code support for five graph domain adaptation models.

  • ADAlign (ICLR 2026): adaptive distribution alignment with neural characteristic functions.
  • ImGDA (NeurIPS 2025) and PALA (IJCAI 2025): class-imbalanced graph domain adaptation.
  • SAGA (ICLR 2026): multi-view graph domain adaptation with dynamic view and neighborhood order selection.
  • UAGA (AAAI 2025): open-set cross-network node classification.
  • Model-specific data adapters, benchmark scripts, tests and documentation are included. See the linked model guides for data preparation and runtime requirements.

[08/2025]. We have added support for very recent graph domain adaptation models.

  • 2 recent models including TDSS and DGSDA are supported.

[03/2025]. We now support multi-source-free setting of graph domain adaptation.

  • To perform a multi-source-free domain adaptation task, simply modify one parameter in the model as follows:
model = GraphATA(in_dim=num_features, hid_dim=args.nhid, num_classes=num_classes, num_src_domains=n, device=args.device)
model.fit([source_data, source_data2, ...], target_data)

[12/2024]. We now support source-free setting of graph domain adaptation.

  • 3 recent models including GTrans, SOGA and GraphCTA are supported.

[08/2024]. We support graph-level domain adaptation task.

  • 7 models including A2GNN, AdaGCN, CWGCN, DANE, GRADE, SAGDA, UDAGCN are supported.
  • Various TUDatasets are supported including FRANKENSTEIN, Mutagenicity and PROTEINS.
  • To perform a graph-level domain adaptation task, only one parameter is added to the model as follows:
model = A2GNN(in_dim=num_features, hid_dim=args.nhid, num_classes=num_classes, mode='graph', device=args.device)

Installation

Note: PyGDA depends on PyTorch, PyG, PyTorch Sparse and Pytorch Scatter. PyGDA does not automatically install these libraries for you. Please install them separately in order to run PyGDA successfully.

Required Dependencies:

  • torch>=1.13.1
  • torch_geometric>=2.4.0
  • torch_sparse>=0.6.15
  • torch_scatter>=2.1.0
  • python3
  • scipy
  • sklearn
  • numpy
  • cvxpy
  • tqdm

Installing with pip:

pip install pygda

or

Installation for local development:

git clone https://github.com/pygda-team/pygda
cd pygda
pip install -e .

Quick Start

Step 1: Load Data

from pygda.datasets import CitationDataset

source_dataset = CitationDataset(path, args.source)
target_dataset = CitationDataset(path, args.target)

Step 2: Build Model

from pygda.models import A2GNN

model = A2GNN(in_dim=num_features, hid_dim=args.nhid, num_classes=num_classes, device=args.device)

Step 3: Fit Model

model.fit(source_data, target_data)

Step 4: Evaluation

from pygda.metrics import eval_micro_f1, eval_macro_f1

logits, labels = model.predict(target_data)
preds = logits.argmax(dim=1)
mi_f1 = eval_micro_f1(labels, preds)
ma_f1 = eval_macro_f1(labels, preds)

Create your own GDA model

In addition to the easy application of existing GDA models, PyGDA makes it simple to implement custom models.

  • the customed model should inherit BaseGDA class.
  • implement your fit(), forward_model(), and predict() functions.

Reference

ID Paper Method Venue
01 Semi-Supervised Classification with Graph Convolutional Networks Vanilla GCN ICLR 2017
02 DANE: Domain Adaptive Network Embedding DANE IJCAI 2019
03 Adversarial Deep Network Embedding for Cross-network Node Classification ACDNE AAAI 2020
04 Unsupervised Domain Adaptive Graph Convolutional Networks UDAGCN WWW 2020
05 Adversarial Separation Network for Cross-Network Node Classification ASN CIKM 2021
06 Graph Transfer Learning via Adversarial Domain Adaptation with Graph Convolution AdaGCN TKDE 2022
07 Non-IID Transfer Learning on Graphs GRADE AAAI 2023
08 Graph Domain Adaptation via Theory-Grounded Spectral Regularization SpecReg ICLR 2023
09 Structural Re-weighting Improves Graph Domain Adaptation StruRW ICML 2023
10 Improving Graph Domain Adaptation with Network Hierarchy JHGDA CIKM 2023
11 Bridged-GNN: Knowledge Bridge Learning for Effective Knowledge Transfer KBL CIKM 2023
12 Domain-adaptive Message Passing Graph Neural Network DMGNN NN 2023
13 Correntropy-Induced Wasserstein GCN: Learning Graph Embedding via Domain Adaptation CWGCN TIP 2023
14 SA-GDA: Spectral Augmentation for Graph Domain Adaptation SAGDA MM 2023
15 Empowering Graph Representation Learning with Test-Time Graph Transformation GTrans ICLR 2023
16 Graph Domain Adaptation: A Generative View DGDA TKDD 2024
17 Rethinking Propagation for Unsupervised Graph Domain Adaptation A2GNN AAAI 2024
18 Pairwise Alignment Improves Graph Domain Adaptation PairAlign ICML 2024
19 Structure Enhanced Prototypical Alignment for Unsupervised Cross-Domain Node Classification SEPA NN 2024
20 Source Free Unsupervised Graph Domain Adaptation SOGA WSDM 2024
21 Collaborate to Adapt: Source-Free Graph Domain Adaptation via Bi-directional Adaptation GraphCTA WWW 2024
22 Smoothness Really Matters: A Simple Yet Effective Approach for Unsupervised Graph Domain Adaptation TDSS AAAI 2025
23 Aggregate to Adapt: Node-Centric Aggregation for Multi-Source-Free Graph Domain Adaptation GraphATA WWW 2025
24 Disentangled Graph Spectral Domain Adaptation DGSDA ICML 2025
25 Open-Set Cross-Network Node Classification via Unknown-Excluded Adversarial Graph Domain Alignment UAGA AAAI 2025
26 PALA: Class-imbalanced Graph Domain Adaptation via Prototype-anchored Learning and Alignment PALA IJCAI 2025
27 Dual Prototype-Enhanced Contrastive Framework for Class-Imbalanced Graph Domain Adaptation ImGDA NeurIPS 2025
28 Learning Adaptive Distribution Alignment with Neural Characteristic Function for Graph Domain Adaptation ADAlign ICLR 2026
29 SAGA: Structural Aggregation Guided Alignment with Dynamic View and Neighborhood Order Selection for Multiview Graph Domain Adaptation SAGA ICLR 2026

Cite

If you compare with, build on, or use aspects of PyGDA, please consider citing "Revisiting, Benchmarking and Understanding Unsupervised Graph Domain Adaptation":

@inproceedings{liu2024revisiting,
title={Revisiting, Benchmarking and Understanding Unsupervised Graph Domain Adaptation},
author={Meihan Liu and Zhen Zhang and Jiachen Tang and Jiajun Bu and Bingsheng He and Sheng Zhou},
booktitle={The Thirty-eight Conference on Neural Information Processing Systems Datasets and Benchmarks Track},
year={2024},
url={https://openreview.net/forum?id=ZsyFwzuDzD}
}

Metadata

Release files for pygda 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygda 1.3.0
File Size Uploaded Provenance Actions
pygda-1.3.0.tar.gz 184.8 kB With provenance Details for pygda-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pygda 1.3.0
File Interpreter ABI Platform Actions
pygda-1.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for pygda-1.3.0-py2.py3-none-any.whl

Total release size: 450.0 kB

Release files / pygda-1.3.0.tar.gz

Download URL pygda-1.3.0.tar.gz
Size 184.8 kB
Tags Source
SHA-256 checksum
How to use checksums
df810bb452478d95d70ee36b23700d8ecec00267fc2694fc022ab46140a57e3a
BLAKE2b-256 checksum
How to use checksums
0eaa97ce153c8826392cdce055a913b3935cfe0d94d195a71e0dd8433e8c8f11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / pygda-1.3.0-py2.py3-none-any.whl

Download URL pygda-1.3.0-py2.py3-none-any.whl
Size 265.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cdbf91073daf7be62a76f92fe0b2e5ef14af9749aa0218f80e63fecf43f02897
BLAKE2b-256 checksum
How to use checksums
5a6d2b5cafda8bbb10e5f5621b61fc71cd0d9c0948b371e804a7eb58fc93c85f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for pygda 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pygda-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page