Synthetic

These datasets are produced using generators, for example Erdos-Renyi, Barabasi-Albert, etc. Tasks are generic, for example predicting tree depth, and intended primarily for benchmarking purposes.

class bgd.synthetic.CommunityDataset(root, stage='train', transform=None, pre_transform=None, pre_filter=None, num=2000)[source]

Bases: InMemoryDataset

Contributor: Alex O. Davies

Contributor email: alexander.davies@bristol.ac.uk

Dataset of random community-like graphs, composed of four evenly sized subgraphs with a random inter-subgraph edge probability. Subgraphs have a density of 0.5, and inter-subgraph edges have a random density between 0.05 and 0.15.

The target is the inter-subgraph density of each graph.

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

  • stage (str) – The stage of the dataset to load. One of “train”, “val”, “test”. (default: "train")

  • 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)

  • num (int) – The number of samples to take from the original dataset. -1 takes all available samples for that stage. (default: -1).

__init__(root, stage='train', transform=None, pre_transform=None, pre_filter=None, num=2000)[source]
process()[source]
property processed_file_names
property raw_file_names
class bgd.synthetic.RandomDataset(root, stage='train', transform=None, pre_transform=None, pre_filter=None, num=2000)[source]

Bases: InMemoryDataset

Contributor: Alex O. Davies

Contributor email: alexander.davies@bristol.ac.uk

Dataset of random erdos-renyi graphs, between 12 and 128 nodes, of random density between 0.05 and 0.3.

The target is the density of each graph.

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

  • stage (str) – The stage of the dataset to load. One of “train”, “val”, “test”. (default: "train")

  • 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)

  • num (int) – The number of samples to take from the original dataset. -1 takes all available samples for that stage. (default: -1).

__init__(root, stage='train', transform=None, pre_transform=None, pre_filter=None, num=2000)[source]
process()[source]
property processed_file_names
property raw_file_names
class bgd.synthetic.TreeDataset(root, stage='train', transform=None, pre_transform=None, pre_filter=None, num=2000)[source]

Bases: InMemoryDataset

Contributor: Alex O. Davies

Contributor email: alexander.davies@bristol.ac.uk

Dataset of random tree structures, between 8 and 96 nodes, produced with networkx.random_tree.

The target is the depth of the tree, normalised by the number of nodes in the tree.

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

  • stage (str) – The stage of the dataset to load. One of “train”, “val”, “test”. (default: "train")

  • 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)

  • num (int) – The number of samples to take from the original dataset. -1 takes all available samples for that stage. (default: -1).

__init__(root, stage='train', transform=None, pre_transform=None, pre_filter=None, num=2000)[source]
process()[source]
property processed_file_names
property raw_file_names