Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Fix bug when making an adjacency_matrix from a SimpleGraph with self-loops in Julia 1.7 #1595

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/linalg/spectral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ function _adjacency_matrix(g::AbstractGraph, T::DataType, neighborfn::Function,
for j in 1:n_v # this is by column, not by row.
if has_edge(g, j, j)
push!(selfloops, j)
if !(T <: Bool) && !is_directed(g)
nz -= 1
end
end
dsts = sort(neighborfn(g, j)) # TODO for most graphs it might not be necessary to sort
colpt[j + 1] = colpt[j] + length(dsts)
Expand Down