load_data
Load Graph Datasets
- graph_datasets.load_data.load_data(dataset_name: str, directory: str = './data', verbosity: int = 0, source: str = 'pyg', return_type: str = 'dgl', rm_self_loop: bool = True, to_simple: bool = True) Tuple[DGLGraph, Tensor, int] [source]
Load graphs.
- Parameters:
dataset_name (str) – Dataset name.
directory (str, optional) – Raw dir for loading or saving. Defaults to DEFAULT_DATA_DIR=os.path.abspath(“./data”).
verbosity (int, optional) – Output debug information. The greater, the more detailed. Defaults to 0.
source (str, optional) – Source for data loading. Defaults to “pyg”.
return_type (str, optional) – Return type of the graphs within [“dgl”, “pyg”]. Defaults to “dgl”.
rm_self_loop (str, optional) – Remove self loops. Defaults to True.
to_simple (str, optional) – Convert to a simple graph with no duplicate undirected edges.
- Raises:
NotImplementedError – Dataset unknown.
- Returns:
[graph, label, n_clusters]
- Return type:
Tuple[dgl.DGLGraph, torch.Tensor, int]
Example
from graph_datasets import load_data # dgl graph graph, label, n_clusters = load_data( dataset_name='cora', directory="./data", return_type="dgl", source='pyg', verbosity=3, rm_self_loop=True, to_simple=True, ) # pyG data data = load_data( dataset_name='cora', directory="./data", return_type="pyg", source='pyg', verbosity=3, rm_self_loop=True, to_simple=True, )