torch_geometric.datasets.GEDDataset

class GEDDataset(root: str, name: str, train: bool = True, transform: Optional[Callable] = None, pre_transform: Optional[Callable] = None, pre_filter: Optional[Callable] = None, force_reload: bool = False)[source]

Bases: InMemoryDataset

The GED datasets from the “Graph Edit Distance Computation via Graph Neural Networks” paper.

GEDs can be accessed via the global attributes ged and norm_ged for all train/train graph pairs and all train/test graph pairs:

dataset = GEDDataset(root, name="LINUX")
data1, data2 = dataset[0], dataset[1]
ged = dataset.ged[data1.i, data2.i]  # GED between `data1` and `data2`.

Note that GEDs are not available if both graphs are from the test set. For evaluation, it is recommended to pair up each graph from the test set with each graph in the training set.

Note

ALKANE is missing GEDs for train/test graph pairs since they are not provided in the official datasets.

Parameters:
  • root (str) – Root directory where the dataset should be saved.

  • name (str) – The name of the dataset (one of "AIDS700nef", "LINUX", "ALKANE", "IMDBMulti").

  • train (bool, optional) – If True, loads the training dataset, otherwise the test dataset. (default: True)

  • transform (callable, optional) – A function/transform that takes in an torch_geometric.data.Data object and returns a transformed version. The data object will be transformed before every access. (default: None)

  • pre_transform (callable, optional) – A function/transform that takes in an torch_geometric.data.Data object and returns a transformed version. The data object will be transformed before being saved to disk. (default: None)

  • pre_filter (callable, optional) – A function that takes in an torch_geometric.data.Data object and returns a boolean value, indicating whether the data object should be included in the final dataset. (default: None)

  • force_reload (bool, optional) – Whether to re-process the dataset. (default: False)

STATS:

Name

#graphs

#nodes

#edges

#features

#classes

AIDS700nef

700

~8.9

~17.6

29

0

LINUX

1,000

~7.6

~13.9

0

0

ALKANE

150

~8.9

~15.8

0

0

IMDBMulti

1,500

~13.0

~131.9

0

0