@@ -17,8 +17,8 @@ include("topological_sort.jl")
17
17
nnz::Int
18
18
end
19
19
20
- Represent the set `nzidx[1:nnz]` by additionally setting `empty[i]` to `true `
21
- for each element of the set for fast membership check.
20
+ Represent the set `nzidx[1:nnz]` by additionally setting `empty[i]` to `false `
21
+ for each element `i` of the set for fast membership check.
22
22
"""
23
23
mutable struct IndexedSet
24
24
nzidx:: Vector{Int}
@@ -44,6 +44,8 @@ function Base.empty!(v::IndexedSet)
44
44
return v
45
45
end
46
46
47
+ # Returns the maximum index that the set can contain,
48
+ # not the cardinality of the set like `length(::Base.Set)`
47
49
Base. length (v:: IndexedSet ) = length (v. nzidx)
48
50
49
51
function Base. resize! (v:: IndexedSet , n:: Integer )
75
77
76
78
Compact storage for an undirected graph. The number of nodes is given by
77
79
`length(offsets) - 1`. The edges of node `u` are given by `edges[e]` for
78
- `e in edgeindex[offsets[u]:(offsets[u] - 1)]`. The neighbors are also
79
- stored at `adjlist[offsets[u]:(offsets[u] - 1)]`.
80
+ `e in edgeindex[offsets[u]:(offsets[u+1 ] - 1)]`. The neighbors are also
81
+ stored at `adjlist[offsets[u]:(offsets[u+1 ] - 1)]`.
80
82
"""
81
83
struct UndirectedGraph
82
84
adjlist:: Vector{Int}
@@ -473,7 +475,7 @@ function hessian_color_preprocess(
473
475
push! (I, i)
474
476
push! (J, j)
475
477
end
476
- local_indices = sort! (seen_idx. nzidx[ 1 : seen_idx . nnz] )
478
+ local_indices = sort! (collect ( seen_idx) )
477
479
empty! (seen_idx)
478
480
global_to_local_idx = seen_idx. nzidx # steal for storage
479
481
for k in eachindex (local_indices)
0 commit comments