@@ -17,8 +17,8 @@ include("topological_sort.jl")
1717 nnz::Int
1818 end
1919
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.
2222"""
2323mutable struct IndexedSet
2424 nzidx:: Vector{Int}
@@ -44,6 +44,8 @@ function Base.empty!(v::IndexedSet)
4444 return v
4545end
4646
47+ # Returns the maximum index that the set can contain,
48+ # not the cardinality of the set like `length(::Base.Set)`
4749Base. length (v:: IndexedSet ) = length (v. nzidx)
4850
4951function Base. resize! (v:: IndexedSet , n:: Integer )
7577
7678Compact storage for an undirected graph. The number of nodes is given by
7779`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)]`.
8082"""
8183struct UndirectedGraph
8284 adjlist:: Vector{Int}
@@ -473,7 +475,7 @@ function hessian_color_preprocess(
473475 push! (I, i)
474476 push! (J, j)
475477 end
476- local_indices = sort! (seen_idx. nzidx[ 1 : seen_idx . nnz] )
478+ local_indices = sort! (collect ( seen_idx) )
477479 empty! (seen_idx)
478480 global_to_local_idx = seen_idx. nzidx # steal for storage
479481 for k in eachindex (local_indices)
0 commit comments