Unverified Commit edb97877 authored by Mufei Li's avatar Mufei Li Committed by GitHub
Browse files

[Doc, UG, Tutorial] Misc Fix (#2376)

* Update

* Update

* Update

* Update

* Update
parent 6b02babb
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
5.2 Edge Classification/Regression 5.2 Edge Classification/Regression
--------------------------------------------- ---------------------------------------------
Sometimes you wish to predict the attributes on the edges of the graph, Sometimes you wish to predict the attributes on the edges of the graph. In that
or even whether an edge exists or not between two given nodes. In that
case, you would like to have an *edge classification/regression* model. case, you would like to have an *edge classification/regression* model.
Here we generate a random graph for edge prediction as a demonstration. Here we generate a random graph for edge prediction as a demonstration.
......
...@@ -259,6 +259,8 @@ def heterograph(data_dict, ...@@ -259,6 +259,8 @@ def heterograph(data_dict,
formats and chooses the most efficient one depending on the computation invoked. formats and chooses the most efficient one depending on the computation invoked.
If memory usage becomes an issue in the case of large graphs, use If memory usage becomes an issue in the case of large graphs, use
:func:`dgl.DGLGraph.formats` to restrict the allowed formats. :func:`dgl.DGLGraph.formats` to restrict the allowed formats.
4. DGL internally decides a deterministic order for the same set of node types and canonical
edge types, which does not necessarily follow the order in :attr:`data_dict`.
Examples Examples
-------- --------
......
...@@ -64,7 +64,7 @@ def build_karate_club_graph(): ...@@ -64,7 +64,7 @@ def build_karate_club_graph():
u = np.concatenate([src, dst]) u = np.concatenate([src, dst])
v = np.concatenate([dst, src]) v = np.concatenate([dst, src])
# Construct a DGLGraph # Construct a DGLGraph
return dgl.DGLGraph((u, v)) return dgl.graph((u, v))
############################################################################### ###############################################################################
# Print out the number of nodes and edges in our newly constructed graph: # Print out the number of nodes and edges in our newly constructed graph:
......
...@@ -49,7 +49,7 @@ import torch.nn as nn ...@@ -49,7 +49,7 @@ import torch.nn as nn
import torch.nn.functional as F import torch.nn.functional as F
from dgl import DGLGraph from dgl import DGLGraph
gcn_msg = fn.copy_src(src='h', out='m') gcn_msg = fn.copy_u(u='h', out='m')
gcn_reduce = fn.sum(msg='m', out='h') gcn_reduce = fn.sum(msg='m', out='h')
############################################################################### ###############################################################################
...@@ -95,15 +95,14 @@ print(net) ...@@ -95,15 +95,14 @@ print(net)
############################################################################### ###############################################################################
# We load the cora dataset using DGL's built-in data module. # We load the cora dataset using DGL's built-in data module.
from dgl.data import citation_graph as citegrh from dgl.data import CoraGraphDataset
import networkx as nx
def load_cora_data(): def load_cora_data():
data = citegrh.load_cora() dataset = CoraGraphDataset()
features = th.FloatTensor(data.features) g = dataset[0]
labels = th.LongTensor(data.labels) features = g.ndata['feat']
train_mask = th.BoolTensor(data.train_mask) labels = g.ndata['label']
test_mask = th.BoolTensor(data.test_mask) train_mask = g.ndata['train_mask']
g = DGLGraph(data.graph) test_mask = g.ndata['test_mask']
return g, features, labels, train_mask, test_mask return g, features, labels, train_mask, test_mask
############################################################################### ###############################################################################
......
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