"src/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "a0c22997fd45770fffd9b454625e9ab525fa2b16"
Unverified Commit 32ea1b20 authored by Quan (Andy) Gan's avatar Quan (Andy) Gan Committed by GitHub
Browse files

remove edge list creation (#1688)

parent 7afd1d0d
...@@ -69,10 +69,6 @@ start2 = dgl.DGLGraph((0, v)) ...@@ -69,10 +69,6 @@ start2 = dgl.DGLGraph((0, v))
adj = spp.coo_matrix((np.ones(len(u)), (u.numpy(), v.numpy()))) adj = spp.coo_matrix((np.ones(len(u)), (u.numpy(), v.numpy())))
star3 = dgl.DGLGraph(adj) star3 = dgl.DGLGraph(adj)
# Create the same graph from a list of integer pairs.
elist = [(0, 1), (0, 2), (0, 3), (0, 4), (0, 5)]
star4 = dgl.DGLGraph(elist)
############################################################################### ###############################################################################
# You can also create a graph by progressively adding more nodes and edges. # You can also create a graph by progressively adding more nodes and edges.
# Although it is not as efficient as the above constructors, it is suitable # Although it is not as efficient as the above constructors, it is suitable
......
...@@ -96,14 +96,15 @@ using the heterograph class and its associated API. ...@@ -96,14 +96,15 @@ using the heterograph class and its associated API.
# #
# For instance, the following code creates the user-item interactions heterograph shown earlier. # For instance, the following code creates the user-item interactions heterograph shown earlier.
# Each value of the dictionary is a list of edge tuples. # Each value of the dictionary is a pair of source and destination arrays.
# Nodes are integer IDs starting from zero. Nodes IDs of different types have # Nodes are integer IDs starting from zero. Nodes IDs of different types have
# separate countings. # separate countings.
import dgl import dgl
import numpy as np
ratings = dgl.heterograph( ratings = dgl.heterograph(
{('user', '+1', 'movie') : [(0, 0), (0, 1), (1, 0)], {('user', '+1', 'movie') : (np.array([0, 0, 1]), np.array([0, 1, 0])),
('user', '-1', 'movie') : [(2, 1)]}) ('user', '-1', 'movie') : (np.array([2]), np.array([1]))})
############################################################################### ###############################################################################
# DGL supports creating a graph from a variety of data sources. The following # DGL supports creating a graph from a variety of data sources. The following
...@@ -130,11 +131,6 @@ ratings = dgl.heterograph( ...@@ -130,11 +131,6 @@ ratings = dgl.heterograph(
{('user', '+1', 'movie') : plus1, {('user', '+1', 'movie') : plus1,
('user', '-1', 'movie') : minus1}) ('user', '-1', 'movie') : minus1})
# Creating from edge indices
ratings = dgl.heterograph(
{('user', '+1', 'movie') : ([0, 0, 1], [0, 1, 0]),
('user', '-1', 'movie') : ([2], [1])})
############################################################################### ###############################################################################
# Manipulating heterograph # Manipulating heterograph
# ------------------------ # ------------------------
......
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