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
10
10
11
11
include (" topological_sort.jl" )
12
12
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
+ """
14
23
mutable struct IndexedSet
15
24
nzidx:: Vector{Int}
16
25
empty:: BitVector
@@ -56,8 +65,19 @@ function Base.union!(v::IndexedSet, s)
56
65
return
57
66
end
58
67
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
+ """
61
81
struct UndirectedGraph
62
82
adjlist:: Vector{Int}
63
83
edgeindex:: Vector{Int} # corresponding edge number, indexed as adjlist
You can’t perform that action at this time.
0 commit comments