Skip to content

Commit acb3d16

Browse files
Kenoetiennedeg
andauthored
adjacency_matrix: Collect neighbors before sorting them (#71)
* adjacency_matrix: Collect neighbors before sorting them The neighbors list may be an iterator that is not sortable. Make sure to collect it first to get an array back. * change to `sort!` Co-authored-by: Etienne dg <[email protected]>
1 parent 0e5ba58 commit acb3d16

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/linalg/spectral.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function _adjacency_matrix(g::AbstractGraph, T::DataType, neighborfn::Function,
5959
nz -= 1
6060
end
6161
end
62-
dsts = sort(neighborfn(g, j)) # TODO for most graphs it might not be necessary to sort
62+
dsts = sort!(collect(neighborfn(g, j))) # TODO for most graphs it might not be necessary to sort
6363
colpt[j + 1] = colpt[j] + length(dsts)
6464
append!(rowval, dsts)
6565
end

0 commit comments

Comments
 (0)