Skip to content

CitationFull

CitationFull(
    name: CITATION_FULL_NAMES,
    to_undirected: bool = True,
    base_dir: Optional[str] = None,
    pre_transform: Optional[Callable] = None,
    transform: Optional[Callable] = None,
)

Bases: Dataset

The full citation network datasets from the "Deep Gaussian Embedding of Graphs: Unsupervised Inductive Learning via Ranking" paper.

Nodes represent documents and edges represent citation links. Node features are binary bag-of-words vectors and the task is to predict the topic of each document. Contrary to PlanetoidDataset, these are the full graphs (no largest-connected-component filtering) and they come without train/validation/test split; create one with e.g. RandomNodeSplit.

This dataset follows the implementation of PyG.

Name #nodes #edges #features #classes
cora 19,793 126,842 8,710 70
cora_ml 2,995 16,316 2,879 7
citeseer 4,230 10,674 602 6
dblp 17,716 105,734 1,639 4
pubmed 19,717 88,648 500 3

Parameters:

Name Type Description Default
name CITATION_FULL_NAMES

The name of the dataset ("cora", "cora_ml", "citeseer", "dblp", "pubmed").

required
to_undirected bool

Whether the original graph is converted to an undirected one. Default: True.

True
base_dir Optional[str]

Directory where to store dataset files. Default is in the local directory .mlx_graphs_data/.

None
pre_transform Optional[Callable]

A function/transform applied to the graph once, before it is saved.

None
transform Optional[Callable]

A function/transform applied to the graph at every access.

None

Example:

from mlx_graphs.datasets import CitationFull

dataset = CitationFull("cora_ml")
>>> cora_ml_full(num_graphs=1)

dataset[0]
>>> GraphData(
        edge_index(shape=(2, 16316), int32)
        node_features(shape=(2995, 2879), float32)
        node_labels(shape=(2995,), int32))
Source code in mlx_graphs/datasets/citation_full.py
def __init__(
    self,
    name: CITATION_FULL_NAMES,
    to_undirected: bool = True,
    base_dir: Optional[str] = None,
    pre_transform: Optional[Callable] = None,
    transform: Optional[Callable] = None,
):
    name = name.lower()  # type: ignore
    assert name in get_args(CITATION_FULL_NAMES), "Invalid dataset name"
    self._npz_name = name
    self.to_undirected = to_undirected
    super().__init__(
        name=f"{name}_full",
        base_dir=base_dir,
        pre_transform=pre_transform,
        transform=transform,
    )

from mlx_graphs.datasets import CitationFull · mlx_graphs/datasets/citation_full.py