File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,15 +137,17 @@ struct DegreeBuckets{T}
137137 positions:: Vector{T}
138138end
139139
140- function DegreeBuckets (:: Type{T} , degrees:: Vector{<:Integer } , dmax:: Integer ) where {T}
140+ function DegreeBuckets (:: Type{T} , degrees:: Vector{T } , dmax:: Integer ) where {T}
141141 # number of vertices per degree class
142142 deg_count = zeros (T, dmax + 1 )
143143 for d in degrees
144144 deg_count[d + 1 ] += 1
145145 end
146146 # bucket limits
147- bucket_high = convert (Vector{T}, cumsum (deg_count))
148- bucket_low = vcat (zero (T), @view (bucket_high[1 : (end - 1 )]))
147+ bucket_high = accumulate (+ , deg_count)
148+ bucket_low = similar (bucket_high)
149+ bucket_low[1 ] = 0
150+ bucket_low[2 : end ] .= bucket_high[1 : (end - 1 )]
149151 bucket_low .+ = 1
150152 # assign each vertex to the correct position inside its degree class
151153 bucket_storage = similar (degrees, T)
You can’t perform that action at this time.
0 commit comments