Skip to content

Commit ef9124a

Browse files
update
1 parent 4dd934b commit ef9124a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/gnngraph.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,11 @@ function adjacency_list(g::GNNGraph; dir=:out)
263263
end
264264

265265
function LightGraphs.adjacency_matrix(g::GNNGraph{<:COO_T}, T::DataType=Int; dir=:out)
266-
A, n, m = to_sparse(g.graph, T, num_nodes=g.num_nodes)
266+
if g.graph[1] isa CuVector
267+
A, n, m = to_dense(g.graph, T, num_nodes=g.num_nodes)
268+
else
269+
A, n, m = to_sparse(g.graph, T, num_nodes=g.num_nodes)
270+
end
267271
@assert size(A) == (n, n)
268272
return dir == :out ? A : A'
269273
end

src/graph_conversions.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ end
124124

125125
function to_sparse(coo::COO_T, T::DataType=Int; dir=:out, num_nodes=nothing)
126126
s, t, eweight = coo
127-
s isa CuVector && return to_dense(coo, T; dir, num_nodes)
128127
eweight = isnothing(eweight) ? fill!(similar(s, T), 1) : eweight
129128
num_nodes = isnothing(num_nodes) ? max(maximum(s), maximum(t)) : num_nodes
130129
A = sparse(s, t, eweight, num_nodes, num_nodes)

0 commit comments

Comments
 (0)