Skip to content

Commit 99304d4

Browse files
authored
Add docstring to internal structs in Coloring (#2560)
1 parent f7cf874 commit 99304d4

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/Nonlinear/ReverseAD/Coloring/Coloring.jl

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ import DataStructures
1010

1111
include("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+
"""
1423
mutable struct IndexedSet
1524
nzidx::Vector{Int}
1625
empty::BitVector
@@ -56,8 +65,19 @@ function Base.union!(v::IndexedSet, s)
5665
return
5766
end
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+
"""
6181
struct UndirectedGraph
6282
adjlist::Vector{Int}
6383
edgeindex::Vector{Int} # corresponding edge number, indexed as adjlist

0 commit comments

Comments
 (0)