DGL工具
Binary_1012382501
这个作者很懒,什么都没留下…
展开
-
Dgl+Pytorch实现节点分类
import dgl import numpy as np def 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 · 1959 阅读 · 0 评论 -
DGL系列之(二):使用DGL实现GCN
import dgl import dgl.function as fn import torch as th 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_reduce=fn.sum(msg="m",...原创 2020-03-10 21:48:33 · 5024 阅读 · 2 评论 -
DGL工具系列(一):用DGL实现pageRank算法
import networkx as nx import matplotlib.pyplot as plt import torch import dgl N=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 · 1012 阅读 · 0 评论
分享