Skip to content

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 authored and etiennedeg committed Oct 29, 2021
1 parent 6ab2160 commit d514caf
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 @@ -24,6 +24,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 @@ -51,6 +53,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 d514caf

Please sign in to comment.