KarateClubDataset

class dgl.data.KarateClubDataset(transform=None)[source]

Bases: dgl.data.dgl_dataset.DGLDataset

Karate Club dataset for Node Classification

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

    >>> dataset = KarateClubDataset()
    >>> g = dataset[0]
    

Zachary’s karate club is a social network of a university karate club, described in the paper “An Information Flow Model for Conflict and Fission in Small Groups” by Wayne W. Zachary. The network became a popular example of community structure in networks after its use by Michelle Girvan and Mark Newman in 2002. Official website: http://konect.cc/networks/ucidata-zachary/

Karate Club dataset statistics:

  • Nodes: 34

  • Edges: 156

  • Number of Classes: 2

Parameters

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 node classes

Type

int

data

A list of dgl.DGLGraph objects

Type

list

Examples

>>> dataset = KarateClubDataset()
>>> num_classes = dataset.num_classes
>>> g = dataset[0]
>>> labels = g.ndata['label']
__getitem__(idx)[source]

Get graph object

Parameters

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

Returns

graph structure and labels.

  • ndata['label']: ground truth labels

Return type

dgl.DGLGraph

__len__()[source]

The number of graphs in the dataset.