dgl.data.utils.load_graphs

dgl.data.utils.load_graphs(filename, idx_list=None)[source]

Load DGLGraphs from file

Parameters:
  • filename (str) – filename to load DGLGraphs
  • idx_list (list of int) – list of index of graph to be loaded. If not specified, will load all graphs from file
Returns:

  • graph_list (list of immutable DGLGraphs)
  • labels (dict of labels stored in file (empty dict returned if no)
  • label stored)

Examples

Following the example in save_graphs.

>>> from dgl.utils.data import load_graphs
>>> glist, label_dict = load_graphs("./data.bin") # glist will be [g1, g2]
>>> glist, label_dict = load_graphs("./data.bin", [0]) # glist will be [g1]