dgl.load_graphsΒΆ
-
dgl.
load_graphs
(filename, idx_list=None)[source]ΒΆ Load graphs and optionally their labels from file saved by
save_graphs()
.Besides loading from local files, DGL supports loading the graphs directly from S3 (by providing a
"s3://..."
path) or from HDFS (by providing"hdfs://..."
a path).- Parameters
- Returns
graph_list (list[DGLGraph]) β The loaded graphs.
labels (dict[str, Tensor]) β The graph labels stored in file. If no label is stored, the dictionary is empty. Regardless of whether the
idx_list
argument is given or not, the returned dictionary always contains the labels of all the graphs.
Examples
Following the example in
save_graphs()
.>>> from dgl.data.utils 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]
See also