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 @@
5.2 Edge Classification/Regression
---------------------------------------------
Sometimes you wish to predict the attributes on the edges of the graph,
or even whether an edge exists or not between two given nodes. In that
Sometimes you wish to predict the attributes on the edges of the graph. In that
case, you would like to have an *edge classification/regression* model.
Here we generate a random graph for edge prediction as a demonstration.
......
......@@ -259,6 +259,8 @@ def heterograph(data_dict,
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
: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
--------
......
......@@ -64,7 +64,7 @@ def build_karate_club_graph():
u = np.concatenate([src, dst])
v = np.concatenate([dst, src])
# 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:
......
......@@ -49,7 +49,7 @@ import torch.nn as nn
import torch.nn.functional as F
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')
###############################################################################
......@@ -95,15 +95,14 @@ print(net)
###############################################################################
# We load the cora dataset using DGL's built-in data module.
from dgl.data import citation_graph as citegrh
import networkx as nx
from dgl.data import CoraGraphDataset
def load_cora_data():
data = citegrh.load_cora()
features = th.FloatTensor(data.features)
labels = th.LongTensor(data.labels)
train_mask = th.BoolTensor(data.train_mask)
test_mask = th.BoolTensor(data.test_mask)
g = DGLGraph(data.graph)
dataset = CoraGraphDataset()
g = dataset[0]
features = g.ndata['feat']
labels = g.ndata['label']
train_mask = g.ndata['train_mask']
test_mask = g.ndata['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