Skip to main content

PubMed-Temporal: A dynamic graph dataset with node-level features

pypi doi

Code to build and reproduce the temporal split for the PubMed/Planetoid graph dataset.

If you use this dataset in your research, please consider citing the paper that introduced it:

Passos, N.A.R.A., Carlini, E., Trani, S. (2024). Deep Community Detection in Attributed Temporal Graphs: Experimental Evaluation of Current Approaches. In Proceedings of the 3rd Graph Neural Networking Workshop 2024 (GNNet '24). Association for Computing Machinery, New York, NY, USA, 1–6.

Description

Graph Split Nodes Edges Class 0 Class 1 Class 2 Time steps Interval (Years)
Full None 19717 44324 4103 7739 7875 42 1967 - 2010
Transductive Train 11664 24645 2964 3508 5192 38 1967 - 2006
Transductive Validation 3697 4535 524 1803 1370 1 2007 - 2007
Transductive Test 9810 15144 1372 4795 3643 3 2008 - 2010
Inductive Train 11664 24645 2964 3508 5192 38 1967 - 2006
Inductive Validation 2093 2113 297 1123 673 1 2007 - 2007
Inductive Test 5960 6928 842 3108 2010 3 2008 - 2010

Node time distribution by class

Edge time distribution by mask (log-scale)

FIrst citation occurs from a paper published in 1967 to another published in 1964.


Load dataset

PyTorch Geometric

from pubmed_temporal import Planetoid
# from torch_geometric.datasets import Planetoid  # pytorch_geometric#9982

dataset = Planetoid(root=".", name="pubmed", split="temporal")
data = dataset[0]
print(data)
Data(x=[19717, 500], edge_index=[2, 88648], y=[19717], time=[88648],
     train_mask=[88648], val_mask=[88648], test_mask=[88648])

The number of edges is doubled in the undirected graph from PyTorch Geometric.

NetworkX

import networkx as nx

G = nx.read_graphml("pubmed/temporal/graph/pubmed-temporal.graphml")
print(G)
DiGraph with 19717 nodes and 44335 edges

The directed graph contains 11 bidirectional edges from co-citing papers.


Build dataset

The temporal split and edge masks for the train, validation, and test splits are already included in this repository.

In order to build it completely from scratch (requires pubmed-id), run:

python build_dataset.py --workers 1

To build the dataset, the following steps are taken, aside from obtaining the required data from PubMed:

  1. Download original PubMed graph dataset.
  2. Build NetworkX object from dataset.
  3. Obtain Planetoid node index map.
  4. Relabel nodes to match Planetoid's index map.
  5. Add weight vectors x.
  6. Add classes y.
  7. Add time steps time.
  8. Verify if dataset matches Planetoid's.
  9. Save data with edge time steps starting from zero.

Extras

To plot the figures and table displayed above:

python extra/build_extra.py

Requires the extra requirements: matplotlib and tabulate.


References

Release files for pubmed-temporal 1.1.2

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

Source distribution (sdist)

Source distribution for pubmed-temporal 1.1.2
File Size Uploaded
pubmed_temporal-1.1.2.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pubmed-temporal 1.1.2
File Interpreter ABI Platform
pubmed_temporal-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / pubmed_temporal-1.1.2.tar.gz

Download URL pubmed_temporal-1.1.2.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
370704021b3ae347fe110fed1730afd6f0d39175a089eae20488f73825f52a97
BLAKE2b-256 checksum
How to use checksums
a8abd0e10b5546809b2d8ab63648481c93529e3c66952ac0cf7f164c9f5c3bd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / pubmed_temporal-1.1.2-py3-none-any.whl

Download URL pubmed_temporal-1.1.2-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2914055d979b31082bf01be2c407846064350222f302dd146d84b175e87fa32d
BLAKE2b-256 checksum
How to use checksums
209e558d1cef9c2520f8bafa108d83a99f15eb0c2ca13b64e731b2b96b0ab7a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1

2 release files

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