BA2MotifDataset(raw_dir=None, force_reload=False, verbose=True, transform=None)[source]¶
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.
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
DGLGraphobject and returns a transformed version. The
DGLGraphobject will be transformed before every access. Default: None
>>> from dgl.data import BA2MotifDataset >>> dataset = BA2MotifDataset() >>> dataset.num_classes 2 >>> # Get the first graph and its label >>> g, label = dataset >>> feat = g.ndata['feat']