CoauthorCSDataset

class dgl.data.CoauthorCSDataset(raw_dir=None, force_reload=False, verbose=False, transform=None)[source]

Bases: dgl.data.gnn_benchmark.GNNBenchmarkDataset

‘Computer Science (CS)’ part of the Coauthor dataset for node classification task.

    Deprecated since version 0.5.0:
  • data is deprecated, it is repalced by:

>>> dataset = CoauthorCSDataset()
>>> graph = dataset[0]

Coauthor CS and Coauthor Physics are co-authorship graphs based on the Microsoft Academic Graph from the KDD Cup 2016 challenge. Here, nodes are authors, that are connected by an edge if they co-authored a paper; node features represent paper keywords for each author’s papers, and class labels indicate most active fields of study for each author.

Reference: https://github.com/shchur/gnn-benchmark#datasets

Statistics:

  • Nodes: 18,333

  • Edges: 163,788 (note that the original dataset has 81,894 edges but DGL adds the reverse edges and remove the duplicates, hence with a different number)

  • Number of classes: 15

  • Node feature size: 6,805

Parameters
  • 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: True.

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

num_classes

Number of classes for each node.

Type

int

data

A list of DGLGraph objects

Type

list

Examples

>>> data = CoauthorCSDataset()
>>> g = data[0]
>>> num_class = data.num_classes
>>> feat = g.ndata['feat']  # get node feature
>>> label = g.ndata['label']  # get node labels
__getitem__(idx)

Get graph by index

Parameters

idx (int) – Item index

Returns

The graph contains:

  • ndata['feat']: node features

  • ndata['label']: node labels

Return type

dgl.DGLGraph

__len__()

Number of graphs in the dataset