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

Commit

Permalink
fix possible NaN in closeness centrality. Closes #1555
Browse files Browse the repository at this point in the history
  • Loading branch information
sbromberger committed Jun 4, 2021
1 parent 6134e21 commit c89498b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Parallel/centrality/closeness.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ function distr_closeness_centrality(g::AbstractGraph,
n = l * 1.0 / (n_v - 1)
closeness[u] *= n
end
else
closeness[u] = 0.0
end
end
end
Expand Down Expand Up @@ -50,6 +52,8 @@ function threaded_closeness_centrality(g::AbstractGraph,
n = l * 1.0 / (n_v - 1)
closeness[u] *= n
end
else
closeness[u] = 0.0
end
end
end
Expand Down

0 comments on commit c89498b

Please sign in to comment.