Commit 45aa1584 authored by Jacob Stevens's avatar Jacob Stevens Committed by VoVAllen
Browse files

Fix example code in saving graphs (#1034)

parent 8f7abb5f
...@@ -87,13 +87,13 @@ def save_graphs(filename, g_list, labels=None): ...@@ -87,13 +87,13 @@ def save_graphs(filename, g_list, labels=None):
>>> g2 = dgl.DGLGraph() >>> g2 = dgl.DGLGraph()
>>> g2.add_nodes(3) >>> g2.add_nodes(3)
>>> g2.add_edges([0, 1, 2], [1, 2, 1]) >>> g2.add_edges([0, 1, 2], [1, 2, 1])
>>> g1.edata["e"] = th.ones(3, 4) >>> g2.edata["e"] = th.ones(3, 4)
Save Graphs into file Save Graphs into file
>>> from dgl.data.utils import save_graphs >>> from dgl.data.utils import save_graphs
>>> graph_labels = {"glabel": th.tensor([0, 1])} >>> graph_labels = {"glabel": th.tensor([0, 1])}
>>> save_graphs([g1, g2], "./data.bin", graph_labels) >>> save_graphs("./data.bin", [g1, g2], graph_labels)
""" """
if isinstance(g_list, DGLGraph): if isinstance(g_list, DGLGraph):
...@@ -130,7 +130,7 @@ def load_graphs(filename, idx_list=None): ...@@ -130,7 +130,7 @@ def load_graphs(filename, idx_list=None):
---------- ----------
Following the example in save_graphs. Following the example in save_graphs.
>>> from dgl.utils.data import load_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") # glist will be [g1, g2]
>>> glist, label_dict = load_graphs("./data.bin", [0]) # glist will be [g1] >>> glist, label_dict = load_graphs("./data.bin", [0]) # glist will be [g1]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment