Skip to content

Commit 9fa3235

Browse files
committed
Fix
1 parent ee20e19 commit 9fa3235

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/order.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,17 @@ struct DegreeBuckets{T}
137137
positions::Vector{T}
138138
end
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)

0 commit comments

Comments
 (0)