Unverified Commit be444e52 authored by Mufei Li's avatar Mufei Li Committed by GitHub
Browse files

[Doc/Feature] Refactor, doc update and behavior fix for graphs (#1983)



* Update graph

* Fix for dgl.graph

* from_scipy

* Replace canonical_etypes with relations

* from_networkx

* Update for hetero_from_relations

* Roll back the change of canonical_etypes to relations

* heterograph

* bipartite

* Update doc

* Fix lint

* Fix lint

* Fix test cases

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Update

* Fix test

* Fix

* Update

* Use DGLError

* Update

* Update

* Update

* Update

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Update

* Fix

* Update

* Fix

* Fix

* Fix

* Update

* Fix

* Update

* Fix

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Fix

* Fix

* Update

* Update

* Update

* Update

* Update

* Update

* rewrite sanity checks

* delete unnecessary checks

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Fix

* Update

* Update

* Update

* Fix

* Fix

* Fix

* Update

* Fix

* Update

* Fix

* Fix

* Update

* Fix

* Update

* Fix
Co-authored-by: default avatarxiang song(charlie.song) <classicxsong@gmail.com>
Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>
Co-authored-by: default avatarQuan Gan <coin2028@hotmail.com>
parent 0afc3cf8
.. _apigraph:
dgl.DGLHeteroGraph
dgl.DGLGraph
=====================================================
.. currentmodule:: dgl
.. autoclass:: DGLHeteroGraph
.. class:: DGLGraph
Querying metagraph structure
----------------------------
......@@ -12,13 +12,15 @@ Querying metagraph structure
.. autosummary::
:toctree: ../../generated/
DGLHeteroGraph.ntypes
DGLHeteroGraph.etypes
DGLHeteroGraph.canonical_etypes
DGLHeteroGraph.metagraph
DGLHeteroGraph.to_canonical_etype
DGLHeteroGraph.get_ntype_id
DGLHeteroGraph.get_etype_id
DGLGraph.ntypes
DGLGraph.etypes
DGLGraph.srctypes
DGLGraph.dsttypes
DGLGraph.canonical_etypes
DGLGraph.metagraph
DGLGraph.to_canonical_etype
DGLGraph.get_ntype_id
DGLGraph.get_etype_id
Querying graph structure
------------------------
......@@ -26,20 +28,27 @@ Querying graph structure
.. autosummary::
:toctree: ../../generated/
DGLHeteroGraph.number_of_nodes
DGLHeteroGraph.number_of_edges
DGLHeteroGraph.is_multigraph
DGLHeteroGraph.has_nodes
DGLHeteroGraph.has_edges_between
DGLHeteroGraph.predecessors
DGLHeteroGraph.successors
DGLHeteroGraph.edge_ids
DGLHeteroGraph.find_edges
DGLHeteroGraph.in_edges
DGLHeteroGraph.out_edges
DGLHeteroGraph.all_edges
DGLHeteroGraph.in_degrees
DGLHeteroGraph.out_degrees
DGLGraph.num_nodes
DGLGraph.number_of_nodes
DGLGraph.num_edges
DGLGraph.number_of_edges
DGLGraph.num_src_nodes
DGLGraph.number_of_src_nodes
DGLGraph.num_dst_nodes
DGLGraph.number_of_dst_nodes
DGLGraph.is_unibipartite
DGLGraph.is_multigraph
DGLGraph.is_homogeneous
DGLGraph.has_nodes
DGLGraph.has_edges_between
DGLGraph.predecessors
DGLGraph.successors
DGLGraph.edge_ids
DGLGraph.find_edges
DGLGraph.in_edges
DGLGraph.out_edges
DGLGraph.in_degrees
DGLGraph.out_degrees
Querying and manipulating sparse format
---------------------------------------
......@@ -47,9 +56,8 @@ Querying and manipulating sparse format
.. autosummary::
:toctree: ../../generated/
DGLHeteroGraph.format_in_use
DGLHeteroGraph.restrict_format
DGLHeteroGraph.to_format
DGLGraph.formats
DGLGraph.create_format_
Querying and manipulating index data type
-----------------------------------------
......@@ -57,9 +65,9 @@ Querying and manipulating index data type
.. autosummary::
:toctree: ../../generated/
DGLHeteroGraph.idtype
DGLHeteroGraph.long
DGLHeteroGraph.int
DGLGraph.idtype
DGLGraph.long
DGLGraph.int
Using Node/edge features
------------------------
......@@ -67,59 +75,86 @@ Using Node/edge features
.. autosummary::
:toctree: ../../generated/
DGLHeteroGraph.nodes
DGLHeteroGraph.ndata
DGLHeteroGraph.edges
DGLHeteroGraph.edata
DGLHeteroGraph.node_attr_schemes
DGLHeteroGraph.edge_attr_schemes
DGLHeteroGraph.set_n_initializer
DGLHeteroGraph.set_e_initializer
DGLHeteroGraph.local_var
DGLHeteroGraph.local_scope
DGLGraph.nodes
DGLGraph.ndata
DGLGraph.edges
DGLGraph.edata
DGLGraph.node_attr_schemes
DGLGraph.edge_attr_schemes
DGLGraph.srcnodes
DGLGraph.dstnodes
DGLGraph.srcdata
DGLGraph.dstdata
DGLGraph.local_var
DGLGraph.local_scope
Using Node/edge features for blocks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please refer to :ref:`guide-minibatch` for the definition of blocks.
Transforming graph
------------------
.. autosummary::
:toctree: ../../generated/
DGLHeteroGraph.number_of_src_nodes
DGLHeteroGraph.number_of_dst_nodes
DGLHeteroGraph.srcnodes
DGLHeteroGraph.srcdata
DGLHeteroGraph.dstnodes
DGLHeteroGraph.dstdata
DGLGraph.subgraph
DGLGraph.edge_subgraph
DGLGraph.node_type_subgraph
DGLGraph.edge_type_subgraph
DGLGraph.__getitem__
Transforming graph
------------------
Converting to other formats
---------------------------
.. autosummary::
:toctree: ../../generated/
DGLHeteroGraph.subgraph
DGLHeteroGraph.edge_subgraph
DGLHeteroGraph.node_type_subgraph
DGLHeteroGraph.edge_type_subgraph
DGLHeteroGraph.__getitem__
DGLGraph.adj
DGLGraph.adjacency_matrix
DGLGraph.inc
DGLGraph.incidence_matrix
Computing with DGLHeteroGraph
Computing with DGLGraph
-----------------------------
.. autosummary::
:toctree: ../../generated/
DGLHeteroGraph.apply_nodes
DGLHeteroGraph.apply_edges
DGLHeteroGraph.send_and_recv
DGLHeteroGraph.pull
DGLHeteroGraph.push
DGLHeteroGraph.update_all
DGLHeteroGraph.multi_update_all
DGLHeteroGraph.prop_nodes
DGLHeteroGraph.prop_edges
DGLHeteroGraph.filter_nodes
DGLHeteroGraph.filter_edges
DGLHeteroGraph.to
DGLGraph.apply_nodes
DGLGraph.apply_edges
DGLGraph.send_and_recv
DGLGraph.pull
DGLGraph.push
DGLGraph.update_all
DGLGraph.multi_update_all
DGLGraph.prop_nodes
DGLGraph.prop_edges
DGLGraph.filter_nodes
DGLGraph.filter_edges
Querying batch summary
----------------------
.. autosummary::
:toctree: ../../generated/
DGLGraph.batch_size
DGLGraph.batch_num_nodes
DGLGraph.batch_num_edges
Mutating topology
-----------------
.. autosummary::
:toctree: ../../generated/
DGLGraph.add_nodes
DGLGraph.add_edges
DGLGraph.remove_nodes
DGLGraph.remove_edges
Device Control
--------------
.. autosummary::
:toctree: ../../generated/
DGLGraph.to
DGLGraph.device
......@@ -81,7 +81,7 @@ here, you can enjoy the same convenience on other frameworks by similar usage):
>>> F.u_mul_e_sum(g, x, y1).shape # (2,), (4, 2) -> (4, 2)
torch.Size([3, 4, 2])
For all operators, the input graph could either be a homograph or a bipartite
For all operators, the input graph could either be a homogeneous or a bipartite
graph.
.. autosummary::
......@@ -228,7 +228,7 @@ The following is an example showing how GSDDMM works:
copy_u
copy_v
Like GSpMM, GSDDMM operators support both homograph and bipartite graph.
Like GSpMM, GSDDMM operators support both homogeneous and bipartite graph.
Edge Softmax module
-------------------
......
......@@ -62,8 +62,8 @@ Graph Transform Routines
to_simple
to_block
compact_graphs
to_hetero
to_homo
to_heterogeneous
to_homogeneous
to_networkx
line_graph
khop_graph
......
......@@ -12,6 +12,8 @@ please `create an issue <https://github.com/dmlc/dgl/issues>`_ started with "[Fe
If you want to contribute a NN module, please `create a pull request <https://github.com/dmlc/dgl/pulls>`_ started
with "[NN] XXXModel in PyTorch NN Modules" and our team member would review this PR.
.. _apinn-pytorch-conv:
Conv Layers
----------------------------------------
......@@ -136,6 +138,7 @@ DotGatConv
:members: forward
:show-inheritance:
.. _apinn-pytorch-dense-conv:
Dense Conv Layers
----------------------------------------
......@@ -161,6 +164,8 @@ DenseChebConv
:members: forward
:show-inheritance:
.. _apinn-pytorch-pooling:
Global Pooling Layers
----------------------------------------
......@@ -232,6 +237,8 @@ HeteroGraphConv
:members:
:show-inheritance:
.. _apinn-pytorch-util:
Utility Modules
----------------------------------------
......
......@@ -267,7 +267,7 @@ The message passing on heterographs can be split into two parts:
relationships.
DGL’s interface to call message passing on heterographs is
`multi_update_all() <https://docs.dgl.ai/generated/dgl.DGLHeteroGraph.multi_update_all.html>`__.
:meth:`~dgl.DGLGraph.multi_update_all`.
``multi_update_all`` takes a dictionary containing the parameters for
``update_all`` within each relation using relation as the key, and a
string represents the cross type reducer. The reducer can be one of
......
......@@ -13,15 +13,12 @@ framework code. The major difference lies in the message passing
operations that are unique in DGL.
DGL has integrated many commonly used
`Sparse_GraphConvs <https://docs.dgl.ai/api/python/nn.pytorch.html#module-dgl.nn.pytorch.conv>`__,
`Dense_GraphConvs <https://docs.dgl.ai/api/python/nn.pytorch.html#dense-conv-layers>`__,
`Graph_Poolings <https://docs.dgl.ai/api/python/nn.pytorch.html#module-dgl.nn.pytorch.glob>`__,
:ref:`apinn-pytorch-conv`, :ref:`apinn-pytorch-dense-conv`, :ref:`apinn-pytorch-pooling`,
and
`Utility <https://docs.dgl.ai/api/python/nn.pytorch.html#utility-modules>`__
NN modules. We welcome your contribution!
:ref:`apinn-pytorch-util`. We welcome your contribution!
In this section, we will use
`dgl.nn.conv.SAGEConv <https://github.com/sneakerkg/dgl/blob/nn_doc_refactor/python/dgl/nn/pytorch/conv/sageconv.py>`__
:class:`~dgl.nn.pytorch.conv.SAGEConv`
with Pytorch backend as an example to introduce how to build your own
DGL NN Module.
......@@ -289,7 +286,7 @@ object construction phase.
Heterogeneous GraphConv Module
------------------------------
`HeteroGraphConv <https://github.com/dmlc/dgl/blob/master/python/dgl/nn/pytorch/hetero.py>`__
:class:`dgl.nn.pytorch.HeteroGraphConv`
is a module-level encapsulation to run DGL NN module on heterogeneous
graph. The implementation logic is the same as message passing level API
``multi_update_all()``:
......
......@@ -237,21 +237,19 @@ class MovieLens(object):
def _generate_enc_graph(self, rating_pairs, rating_values, add_support=False):
user_movie_R = np.zeros((self._num_user, self._num_movie), dtype=np.float32)
user_movie_R[rating_pairs] = rating_values
movie_user_R = user_movie_R.transpose()
rating_graphs = []
data_dict = dict()
num_nodes_dict = {'user': self._num_user, 'movie': self._num_movie}
rating_row, rating_col = rating_pairs
for rating in self.possible_rating_values:
ridx = np.where(rating_values == rating)
rrow = rating_row[ridx]
rcol = rating_col[ridx]
bg = dgl.bipartite((rrow, rcol), 'user', str(rating), 'movie',
num_nodes=(self._num_user, self._num_movie))
rev_bg = dgl.bipartite((rcol, rrow), 'movie', 'rev-%s' % str(rating), 'user',
num_nodes=(self._num_movie, self._num_user))
rating_graphs.append(bg)
rating_graphs.append(rev_bg)
graph = dgl.hetero_from_relations(rating_graphs)
data_dict.update({
('user', str(rating), 'movie'): (rrow, rcol),
('movie', 'rev-%s' % str(rating), 'user'): (rcol, rrow)
})
graph = dgl.heterograph(data_dict, num_nodes_dict=num_nodes_dict)
# sanity check
assert len(rating_pairs[0]) == sum([graph.number_of_edges(et) for et in graph.etypes]) // 2
......@@ -294,7 +292,8 @@ class MovieLens(object):
user_movie_ratings_coo = sp.coo_matrix(
(ones, rating_pairs),
shape=(self.num_user, self.num_movie), dtype=np.float32)
return dgl.bipartite(user_movie_ratings_coo, 'user', 'rate', 'movie')
g = dgl.bipartite_from_scipy(user_movie_ratings_coo, utype='_U', etype='_E', vtype='_V')
return dgl.heterograph({('user', 'rate', 'movie'): g.edges()})
@property
def num_links(self):
......
......@@ -55,7 +55,6 @@ def main(args):
hg = dataset[0]
num_rels = len(hg.canonical_etypes)
num_of_ntype = len(hg.ntypes)
category = dataset.predict_category
num_classes = dataset.num_classes
train_mask = hg.nodes[category].data.pop('train_mask')
......@@ -86,7 +85,7 @@ def main(args):
if ntype == category:
category_id = i
g = dgl.to_homo(hg)
g = dgl.to_homogeneous(hg, edata=['norm'])
num_nodes = g.number_of_nodes()
node_ids = mx.nd.arange(num_nodes)
edge_norm = g.edata['norm']
......
......@@ -10,7 +10,6 @@ from dgl.data import register_data_args, load_data
class GraphData:
def __init__(self, csr, num_feats, graph_name):
num_nodes = csr.shape[0]
num_edges = mx.nd.contrib.getnnz(csr).asnumpy()[0]
self.graph = dgl.graph_index.from_csr(csr.indptr, csr.indices, False, 'in')
self.graph = self.graph.copyto_shared_mem(dgl.contrib.graph_store._get_graph_path(graph_name))
self.features = mx.nd.random.normal(shape=(csr.shape[0], num_feats))
......
......@@ -32,7 +32,10 @@ def get_graph(network_data, vocab):
a heterogenous graph, with one node type and different edge types
'''
graphs = []
num_nodes = len(vocab)
node_type = '_N' # '_N' can be replaced by an arbitrary name
data_dict = dict()
num_nodes_dict = {node_type: len(vocab)}
for edge_type in network_data:
tmp_data = network_data[edge_type]
......@@ -40,9 +43,8 @@ def get_graph(network_data, vocab):
for edge in tmp_data:
edges.append((vocab[edge[0]], vocab[edge[1]]))
edges.append((vocab[edge[1]], vocab[edge[0]]))
g = dgl.graph(edges, etype=edge_type, num_nodes=num_nodes)
graphs.append(g)
graph = dgl.hetero_from_relations(graphs)
data_dict[(node_type, edge_type, node_type)] = zip(*edges)
graph = dgl.heterograph(data_dict, num_nodes_dict)
return graph
......
......@@ -76,8 +76,9 @@ class NodeSampler(object):
yield self.seeds[batches[i]], batches[i]
def create_nodeflow(layer_mappings, block_mappings, block_aux_data, rel_graphs, seed_map):
hg = dgl.hetero_from_relations(rel_graphs)
def create_nodeflow(layer_mappings, block_mappings, block_aux_data,
data_dict, num_nodes_dict, seed_map):
hg = dgl.heterograph(data_dict, num_nodes_dict=num_nodes_dict)
hg.layer_mappings = layer_mappings
hg.block_mappings = block_mappings
hg.block_aux_data = block_aux_data
......@@ -135,7 +136,8 @@ class AdaptGenerator(object):
layer_mappings = [] # Mapping from layer node ID to parent node ID
block_mappings = [] # Mapping from block edge ID to parent edge ID, or -1 if nonexistent
block_aux_data = []
rel_graphs = []
data_dict = dict()
num_nodes_dict = dict()
if self.coalesce:
curr_frontier = torch.LongTensor(np.unique(seeds.numpy()))
......@@ -163,11 +165,13 @@ class AdaptGenerator(object):
aux_result = aux_result[[nodes_idx_map[i] for i in prev_frontier]]
block_dsts = np.arange(len(curr_frontier)).repeat(num_neighbors)
rel_graphs.insert(0, dgl.bipartite(
(block_srcs, block_dsts),
'layer%d' % i, 'block%d' % i, 'layer%d' % (i + 1),
(len(prev_frontier), len(curr_frontier))
))
data_dict.update({
('layer%d' % i, 'block%d' % i, 'layer%d' % (i + 1)): (block_srcs, block_dsts)
})
num_nodes_dict.update({
'layer%d' % i: len(prev_frontier),
'layer%d' % (i + 1): len(curr_frontier)
})
layer_mappings.insert(0, prev_frontier)
block_mappings.insert(0, prev_frontier_edges)
......@@ -179,7 +183,8 @@ class AdaptGenerator(object):
layer_mappings=layer_mappings,
block_mappings=block_mappings,
block_aux_data=block_aux_data,
rel_graphs=rel_graphs,
data_dict=data_dict,
num_nodes_dict=num_nodes_dict,
seed_map=seed_map)
def stepback(self, curr_frontier, layer_index, *auxiliary):
......
......@@ -245,22 +245,20 @@ class MovieLens(object):
def _generate_enc_graph(self, rating_pairs, rating_values, add_support=False):
user_movie_R = np.zeros((self._num_user, self._num_movie), dtype=np.float32)
user_movie_R[rating_pairs] = rating_values
movie_user_R = user_movie_R.transpose()
rating_graphs = []
data_dict = dict()
num_nodes_dict = {'user': self._num_user, 'movie': self._num_movie}
rating_row, rating_col = rating_pairs
for rating in self.possible_rating_values:
ridx = np.where(rating_values == rating)
rrow = rating_row[ridx]
rcol = rating_col[ridx]
rating = to_etype_name(rating)
bg = dgl.bipartite((rrow, rcol), 'user', rating, 'movie',
num_nodes=(self._num_user, self._num_movie))
rev_bg = dgl.bipartite((rcol, rrow), 'movie', 'rev-%s' % rating, 'user',
num_nodes=(self._num_movie, self._num_user))
rating_graphs.append(bg)
rating_graphs.append(rev_bg)
graph = dgl.hetero_from_relations(rating_graphs)
data_dict.update({
('user', str(rating), 'movie'): (rrow, rcol),
('movie', 'rev-%s' % str(rating), 'user'): (rcol, rrow)
})
graph = dgl.heterograph(data_dict, num_nodes_dict=num_nodes_dict)
# sanity check
assert len(rating_pairs[0]) == sum([graph.number_of_edges(et) for et in graph.etypes]) // 2
......@@ -303,7 +301,8 @@ class MovieLens(object):
user_movie_ratings_coo = sp.coo_matrix(
(ones, rating_pairs),
shape=(self.num_user, self.num_movie), dtype=np.float32)
return dgl.bipartite(user_movie_ratings_coo, 'user', 'rate', 'movie')
g = dgl.bipartite_from_scipy(user_movie_ratings_coo, utype='_U', etype='_E', vtype='_V')
return dgl.heterograph({('user', 'rate', 'movie'): g.edges()})
@property
def num_links(self):
......
......@@ -136,8 +136,8 @@ def load_acm(remove_self_loop):
# Adjacency matrices for meta path based neighbors
# (Mufei): I verified both of them are binary adjacency matrices with self loops
author_g = dgl.graph(data['PAP'], ntype='paper', etype='author')
subject_g = dgl.graph(data['PLP'], ntype='paper', etype='subject')
author_g = dgl.from_scipy(data['PAP'])
subject_g = dgl.from_scipy(data['PLP'])
gs = [author_g, subject_g]
train_idx = torch.from_numpy(data['train_idx']).long().squeeze(0)
......@@ -186,11 +186,12 @@ def load_acm_raw(remove_self_loop):
p_vs_t = p_vs_t[p_selected]
p_vs_c = p_vs_c[p_selected]
pa = dgl.bipartite(p_vs_a, 'paper', 'pa', 'author')
ap = dgl.bipartite(p_vs_a.transpose(), 'author', 'ap', 'paper')
pl = dgl.bipartite(p_vs_l, 'paper', 'pf', 'field')
lp = dgl.bipartite(p_vs_l.transpose(), 'field', 'fp', 'paper')
hg = dgl.hetero_from_relations([pa, ap, pl, lp])
hg = dgl.heterograph({
('paper', 'pa', 'author'): p_vs_a.nonzero(),
('author', 'ap', 'paper'): p_vs_a.transpose.nonzero(),
('paper', 'pf', 'field'): p_vs_l.nonzero(),
('field', 'fp', 'paper'): p_vs_l.transpose().nonzero()
})
features = torch.FloatTensor(p_vs_t.toarray())
......
......@@ -80,12 +80,12 @@ def train(model, G):
device = torch.device("cuda:0")
G = dgl.heterograph({
('paper', 'written-by', 'author') : data['PvsA'],
('author', 'writing', 'paper') : data['PvsA'].transpose(),
('paper', 'citing', 'paper') : data['PvsP'],
('paper', 'cited', 'paper') : data['PvsP'].transpose(),
('paper', 'is-about', 'subject') : data['PvsL'],
('subject', 'has', 'paper') : data['PvsL'].transpose(),
('paper', 'written-by', 'author') : data['PvsA'].nonzero(),
('author', 'writing', 'paper') : data['PvsA'].transpose().nonzero(),
('paper', 'citing', 'paper') : data['PvsP'].nonzero(),
('paper', 'cited', 'paper') : data['PvsP'].transpose().nonzero(),
('paper', 'is-about', 'subject') : data['PvsL'].nonzero(),
('subject', 'has', 'paper') : data['PvsL'].transpose().nonzero(),
})
print(G)
......
......@@ -32,7 +32,7 @@ A = grid_graph(28, 8, metric)
coarsening_levels = 4
L, perm = coarsen(A, coarsening_levels)
g_arr = [dgl.graph(csr) for csr in L]
g_arr = [dgl.from_scipy(csr) for csr in L]
coordinate_arr = get_coordinates(g_arr, grid_side, coarsening_levels, perm)
for g, coordinate_arr in zip(g_arr, coordinate_arr):
......
......@@ -59,7 +59,6 @@ def main(args):
hg = dataset[0]
num_rels = len(hg.canonical_etypes)
num_of_ntype = len(hg.ntypes)
category = dataset.predict_category
num_classes = dataset.num_classes
train_mask = hg.nodes[category].data.pop('train_mask')
......@@ -90,7 +89,7 @@ def main(args):
if ntype == category:
category_id = i
g = dgl.to_homo(hg)
g = dgl.to_homogeneous(hg, edata=['norm'])
num_nodes = g.number_of_nodes()
node_ids = torch.arange(num_nodes)
edge_norm = g.edata['norm']
......
......@@ -484,7 +484,7 @@ def main(args, devices):
if ntype == category:
category_id = i
g = dgl.to_homo(hg)
g = dgl.to_homogeneous(hg, edata=['norm'])
if args.global_norm:
u, v, eid = g.all_edges(form='all')
_, inverse_index, count = th.unique(v, return_inverse=True, return_counts=True)
......
......@@ -135,7 +135,7 @@ def build_graph_from_triplets(num_nodes, num_rels, triplets):
This function also generates edge type and normalization factor
(reciprocal of node incoming degree)
"""
g = dgl.graph([])
g = dgl.graph(([], []))
g.add_nodes(num_nodes)
src, rel, dst = triplets
src, dst = np.concatenate((src, dst)), np.concatenate((dst, src))
......
......@@ -19,7 +19,7 @@ class GraphPool:
print('start creating graph pool...')
tic = time.time()
self.n, self.m = n, m
g_pool = [[dgl.graph([]) for _ in range(m)] for _ in range(n)]
g_pool = [[dgl.graph(([], [])) for _ in range(m)] for _ in range(n)]
num_edges = {
'ee': np.zeros((n, n)).astype(int),
'ed': np.zeros((n, m)).astype(int),
......
......@@ -5,7 +5,7 @@
* Author's code for link prediction: [https://github.com/MichSchli/RelationPrediction](https://github.com/MichSchli/RelationPrediction)
### Dependencies
* Tensorflow 2.1+
* Tensorflow 2.2+
* requests
* rdflib
* pandas
......
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