
DGL工具
Binary_1012382501
这个作者很懒,什么都没留下…
展开
-
Dgl+Pytorch实现节点分类
import dglimport numpy as npdef build_karate_club_graph(): # All 78 edges are stored in two numpy arrays. One for source endpoints # while the other for destination endpoints. src = np.array([1, 2, 2, 3, 3, 3, 4, 5, 6, 6, 6, 7, 7, 7, 7, 8,.原创 2020-06-02 10:38:41 · 1981 阅读 · 0 评论 -
DGL系列之(二):使用DGL实现GCN
import dglimport dgl.function as fnimport torch as thimport torch.nn as nnimport torch.nn.functional as Ffrom dgl import DGLGraphgcn_msg=fn.copy_src(src="h",out="m")gcn_reduce=fn.sum(msg="m",...原创 2020-03-10 21:48:33 · 5065 阅读 · 2 评论 -
DGL工具系列(一):用DGL实现pageRank算法
import networkx as nximport matplotlib.pyplot as pltimport torchimport dglN=6#100个节点DAMP=0.85#阻尼系数K=10#迭代次数g=dgl.DGLGraph()g.add_nodes(6)#添加边的关系g.add_edges([1,1,1,2,2,4,0,5,5],[2,3,4,3,5...原创 2020-03-09 19:49:16 · 1063 阅读 · 0 评论