BA2MotifDatasetο
- class dgl.data.BA2MotifDataset(raw_dir=None, force_reload=False, verbose=True, transform=None)[source]ο
Bases:
DGLBuiltinDataset
BA-2motifs dataset from Parameterized Explainer for Graph Neural Network
This is a synthetic dataset for graph classification. It was generated by performing the following steps in order.
Construct 1000 base BarabΓ‘siβAlbert (BA) graphs.
Attach house-structured network motifs to half of the base BA graphs.
Attach five-node cycle motifs to the rest base BA graphs.
Assign each graph to one of two classes according to the type of the attached motif.
- Parameters:
raw_dir (str, optional) β Raw file directory to download and store the data. Default: ~/.dgl/
force_reload (bool, optional) β Whether to reload the dataset. Default: False
verbose (bool, optional) β Whether to print progress information. Default: True
transform (callable, optional) β A transform that takes in a
DGLGraph
object and returns a transformed version. TheDGLGraph
object will be transformed before every access. Default: None
Examples
>>> from dgl.data import BA2MotifDataset >>> dataset = BA2MotifDataset() >>> dataset.num_classes 2 >>> # Get the first graph and its label >>> g, label = dataset[0] >>> feat = g.ndata['feat']