BA2MotifDataset¶
-
class
dgl.data.
BA2MotifDataset
(raw_dir=None, force_reload=False, verbose=True, transform=None)[source]¶ Bases:
dgl.data.dgl_dataset.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']