Skip to content

Commit

Permalink
Add vulnerability gradient
Browse files Browse the repository at this point in the history
  • Loading branch information
Ranjan Anantharaman committed Mar 15, 2016
1 parent 98ee7e3 commit cef1ed0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions graph/grad.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Gunrock
function vulnerability(a::SparseMatrixCSC, n::Integer)
l = size(a, 1)
d = Dict{Int,Vector{Int}}()
dists = sssp(a, n)
max = maximum(dists)
for i = 0:max
setindex!(d, Int[], i)
end
for i = 1:l
push!(d[dists[i]], i)
end
d
end

0 comments on commit cef1ed0

Please sign in to comment.