"vscode:/vscode.git/clone" did not exist on "11974812ca06b387b481e3d3d507290a86974d1f"
Unverified Commit 411bcd7e authored by Da Zheng's avatar Da Zheng Committed by GitHub
Browse files

[BUGFIX] extand DGLGraph graph_data. (#632)

* enable tutorial test in CI.

* extand DGLGraph graph_data.

* update doc.

* Revert "enable tutorial test in CI."

This reverts commit cd774067180922bb6ae979bde4aecbffc61c8147.

* accept DGLGraph in graph store.
parent 2e9949d2
......@@ -52,7 +52,7 @@ def main(args):
n_test_samples))
# create GCN model
g = data.graph
g = dgl.DGLGraph(data.graph, readonly=True)
g.ndata['features'] = features
g.ndata['labels'] = labels
......
......@@ -292,10 +292,19 @@ class SharedMemoryStoreServer(object):
and store them in shared memory. The loaded graph can be identified by
the graph name in the input argument.
DGL graph accepts graph data of multiple formats:
* NetworkX graph,
* scipy matrix,
* DGLGraph.
If the input graph data is DGLGraph, the constructed DGLGraph only contains
its graph index.
Parameters
----------
graph_data : graph data
Data to initialize graph. Same as networkx's semantics.
Data to initialize graph.
edge_dir : string
the edge direction for the graph structure ("in" or "out")
graph_name : string
......@@ -309,14 +318,14 @@ class SharedMemoryStoreServer(object):
"""
def __init__(self, graph_data, edge_dir, graph_name, multigraph, num_workers, port):
self.server = None
if isinstance(graph_data, GraphIndex):
graph_idx = graph_data
if isinstance(graph_data, (GraphIndex, DGLGraph)):
self._graph = DGLGraph(graph_data, multigraph=multigraph, readonly=True)
else:
indptr, indices = _to_csr(graph_data, edge_dir, multigraph)
graph_idx = from_csr(utils.toindex(indptr), utils.toindex(indices),
multigraph, edge_dir, _get_graph_path(graph_name))
self._graph = DGLGraph(graph_idx, multigraph=multigraph, readonly=True)
self._num_workers = num_workers
self._graph_name = graph_name
self._edge_dir = edge_dir
......@@ -1046,10 +1055,19 @@ def create_graph_store_server(graph_data, graph_name, store_type, num_workers,
After the server runs, the graph store clients can access the graph data
with the specified graph name.
DGL graph accepts graph data of multiple formats:
* NetworkX graph,
* scipy matrix,
* DGLGraph.
If the input graph data is DGLGraph, the constructed DGLGraph only contains
its graph index.
Parameters
----------
graph_data : graph data
Data to initialize graph. Same as networkx's semantics.
Data to initialize graph.
graph_name : string
Define the name of the graph.
store_type : string
......
......@@ -756,10 +756,19 @@ class DGLGraph(DGLBaseGraph):
Node and edge features are stored as a dictionary from the feature name
to the feature data (in tensor).
DGL graph accepts graph data of multiple formats:
* NetworkX graph,
* scipy matrix,
* DGLGraph.
If the input graph data is DGLGraph, the constructed DGLGraph only contains
its graph index.
Parameters
----------
graph_data : graph data, optional
Data to initialize graph. Same as networkx's semantics.
Data to initialize graph.
node_frame : FrameRef, optional
Node feature storage.
edge_frame : FrameRef, optional
......@@ -898,6 +907,9 @@ class DGLGraph(DGLBaseGraph):
multigraph=None,
readonly=False):
# graph
if isinstance(graph_data, DGLGraph):
gidx = graph_data._graph
else:
gidx = graph_index.create_graph_index(graph_data, multigraph, readonly)
super(DGLGraph, self).__init__(gidx)
......
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