File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
src/Nonlinear/ReverseAD/Coloring Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,16 @@ import DataStructures
1010
1111include (" topological_sort.jl" )
1212
13- # indexed sparse set of integers
13+ """
14+ mutable struct IndexedSet
15+ nzidx::Vector{Int}
16+ empty::BitVector
17+ nnz::Int
18+ end
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.
22+ """
1423mutable struct IndexedSet
1524 nzidx:: Vector{Int}
1625 empty:: BitVector
@@ -56,8 +65,19 @@ function Base.union!(v::IndexedSet, s)
5665 return
5766end
5867
59- # compact storage for an undirected graph
60- # neighbors of vertex i start at adjlist[offsets[i]]
68+ """
69+ struct UndirectedGraph
70+ adjlist::Vector{Int}
71+ edgeindex::Vector{Int}
72+ offsets::Vector{Int}
73+ edges::Vector{Tuple{Int,Int}}
74+ end
75+
76+ Compact storage for an undirected graph. The number of nodes is given by
77+ `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+ """
6181struct UndirectedGraph
6282 adjlist:: Vector{Int}
6383 edgeindex:: Vector{Int} # corresponding edge number, indexed as adjlist
You can’t perform that action at this time.
0 commit comments