"docs/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "abc47dece65f9e1db040549f6f02516ac4718dea"
Unverified Commit 95dc971b authored by cruyffturn's avatar cruyffturn Committed by GitHub
Browse files

[Doc] Some functions used in the tutorial are deprecated (#2398)



* Some functions used in the tutorial are deprecated

I'm receiving register_message_func and register_reduce_func are deprecated error. I have updated the code such that message and reduce functions are passed to g.send and g.recv

* Update 3_pagerank.py.bak
Co-authored-by: default avatarZihao Ye <expye@outlook.com>
parent ba396602
...@@ -96,12 +96,6 @@ def pagerank_reduce_func(nodes): ...@@ -96,12 +96,6 @@ def pagerank_reduce_func(nodes):
# #
# .. image:: https://i.imgur.com/kIMiuFb.png # .. image:: https://i.imgur.com/kIMiuFb.png
# #
# Register the message function and reduce function, which will be called
# later by DGL.
g.register_message_func(pagerank_message_func)
g.register_reduce_func(pagerank_reduce_func)
############################################################################### ###############################################################################
# The algorithm is straightforward. Here is the code for one # The algorithm is straightforward. Here is the code for one
...@@ -110,10 +104,10 @@ g.register_reduce_func(pagerank_reduce_func) ...@@ -110,10 +104,10 @@ g.register_reduce_func(pagerank_reduce_func)
def pagerank_naive(g): def pagerank_naive(g):
# Phase #1: send out messages along all edges. # Phase #1: send out messages along all edges.
for u, v in zip(*g.edges()): for u, v in zip(*g.edges()):
g.send((u, v)) g.send((u, v), pagerank_message_func)
# Phase #2: receive messages to compute new PageRank values. # Phase #2: receive messages to compute new PageRank values.
for v in g.nodes(): for v in g.nodes():
g.recv(v) g.recv(v, pagerank_reduce_func)
############################################################################### ###############################################################################
...@@ -125,8 +119,8 @@ def pagerank_naive(g): ...@@ -125,8 +119,8 @@ def pagerank_naive(g):
# on multiple nodes and edges at one time. # on multiple nodes and edges at one time.
def pagerank_batch(g): def pagerank_batch(g):
g.send(g.edges()) g.send(g.edges(), pagerank_message_func)
g.recv(g.nodes()) g.recv(g.nodes(), pagerank_reduce_func)
############################################################################### ###############################################################################
......
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