mindspore_gl.dataset.BlogCatalog

class mindspore_gl.dataset.BlogCatalog(root)[source]

BlogCatalog Dataset, a source dataset for reading and parsing BlogCatalog dataset.

About BlogCatalog dataset:

This is the data from BlogCatalog. BlogCatalog is a social blog directory website. This contains the friendship network and group memberships. For easier understanding, all the contents are organized in CSV file format.

Statistics:

  • Nodes: 10,312

  • Edges: 333,983

  • Number of Classes: 39

Dataset can be download here: BlogCatalog .

You can organize the dataset files into the following directory structure and read.

.
└── ppi
    ├── edges.csv
    ├── group-edges.csv
    ├── groups.csv
    └── nodes.csv
Parameters

root (str) – path to the root directory that contains blog_catalog.npz.

Raises

Examples

>>> from mindspore_gl.dataset.blog_catalog import BlogCatalog
>>> root = "path/to/blog_catalog"
>>> dataset = BlogCatalog(root)
property adj_coo

Return the adjacency matrix of COO representation.

Returns

  • numpy.ndarray, array of COO matrix.

Examples

>>> #dataset is an instance object of Dataset
>>> node_label = dataset.adj_coo
property adj_csr

Return the adjacency matrix of CSR representation.

Returns

  • numpy.ndarray, array of CSR matrix.

Examples

>>> #dataset is an instance object of Dataset
>>> node_label = dataset.adj_csr
property edge_count

Number of edges, length of csr col.

Returns

  • int, the number of edges.

Examples

>>> #dataset is an instance object of Dataset
>>> edge_count = dataset.edge_count
property node_count

Number of nodes, length of csr row.

Returns

  • int, the number of nodes.

Examples

>>> #dataset is an instance object of Dataset
>>> node_count = dataset.node_count
property node_label

Ground truth labels of each node.

Returns

  • numpy.ndarray, array of node label.

Examples

>>> #dataset is an instance object of Dataset
>>> node_label = dataset.node_label
property num_classes

Number of label classes.

Returns

  • int, the number of classes.

Examples

>>> #dataset is an instance object of Dataset
>>> num_classes = dataset.num_classes
property vocab

ID of each node.

Returns

  • numpy.ndarray, array of node ID.

Examples

>>> #dataset is an instance object of Dataset
>>> node_label = dataset.vocab