class, force_reload=False, verbose=False, transform=None, reorder=False)[source]

Bases: DGLBuiltinDataset

Flickr dataset for node classification from GraphSAINT: Graph Sampling Based Inductive Learning Method

The task of this dataset is categorizing types of images based on the descriptions and common properties of online images.

Flickr dataset statistics:

  • Nodes: 89,250

  • Edges: 899,756

  • Number of classes: 7

  • Node feature size: 500

  • raw_dir (str) – Raw file directory to download/contains the input data directory. Default: ~/.dgl/

  • force_reload (bool) – Whether to reload the dataset. Default: False

  • verbose (bool) – Whether to print out progress information. Default: False

  • transform (callable, optional) – A transform that takes in a DGLGraph object and returns a transformed version. The DGLGraph object will be transformed before every access.

  • reorder (bool) – Whether to reorder the graph using reorder_graph(). Default: False.


Number of node classes




>>> from import FlickrDataset
>>> dataset = FlickrDataset()
>>> dataset.num_classes
>>> g = dataset[0]
>>> # get node feature
>>> feat = g.ndata['feat']
>>> # get node labels
>>> labels = g.ndata['label']
>>> # get data split
>>> train_mask = g.ndata['train_mask']
>>> val_mask = g.ndata['val_mask']
>>> test_mask = g.ndata['test_mask']

Get graph object


idx (int) – Item index, FlickrDataset has only one graph object


The graph contains:

  • ndata['label']: node label

  • ndata['feat']: node feature

  • ndata['train_mask']: mask for training node set

  • ndata['val_mask']: mask for validation node set

  • ndata['test_mask']: mask for test node set

Return type:



The number of graphs in the dataset.