forked from dmlc/dgl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[API][Doc] API change & basic tutorials (dmlc#113)
* Add SH tutorials * setup sphinx-gallery; work on graph tutorial * draft dglgraph tutorial * update readme to include document url * rm obsolete file * Draft the message passing tutorial * Capsule code (dmlc#102) * add capsule example * clean code * better naming * better naming * [GCN]tutorial scaffold * fix capsule example code * remove previous capsule example code * graph struc edit * modified: 2_graph.py * update doc of capsule * update capsule docs * update capsule docs * add msg passing prime * GCN-GAT tutorial Section 1 and 2 * comment for API improvement * section 3 * Tutorial API change (dmlc#115) * change the API as discusses; toy example * enable the new set/get syntax * fixed pytorch utest * fixed gcn example * fixed gat example * fixed mx utests * fix mx utest * delete apply edges; add utest for update_edges * small change on toy example * fix utest * fix out in degrees bug * update pagerank example and add it to CI * add delitem for dataview * make edges() return form that is compatible with send/update_edges etc * fix index bug when the given data is one-int-tensor * fix doc
- Loading branch information
1 parent
2ecd2b2
commit 68ec624
Showing
29 changed files
with
1,829 additions
and
911 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ def build_dgl() { | |
} | ||
dir ('build') { | ||
sh 'cmake ..' | ||
sh 'make -j$(nproc)' | ||
sh 'make -j4' | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import networkx as nx | ||
import torch | ||
import dgl | ||
import dgl.function as fn | ||
|
||
N = 100 | ||
g = nx.nx.erdos_renyi_graph(N, 0.05) | ||
g = dgl.DGLGraph(g) | ||
|
||
DAMP = 0.85 | ||
K = 10 | ||
|
||
def compute_pagerank(g): | ||
g.ndata['pv'] = torch.ones(N) / N | ||
degrees = g.out_degrees(g.nodes()).type(torch.float32) | ||
for k in range(K): | ||
g.ndata['pv'] = g.ndata['pv'] / degrees | ||
g.update_all(message_func=fn.copy_src(src='pv', out='m'), | ||
reduce_func=fn.sum(msg='m', out='pv')) | ||
g.ndata['pv'] = (1 - DAMP) / N + DAMP * g.ndata['pv'] | ||
return g.ndata['pv'] | ||
|
||
pv = compute_pagerank(g) | ||
print(pv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.