Skip to content

Commit 4cd18b5

Browse files
committed
Address comments
1 parent d25581b commit 4cd18b5

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/coloring.jl

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,12 @@ $TYPEDFIELDS
424424
struct TreeSet{T}
425425
"""
426426
contains the reverse breadth first (BFS) traversal order for each tree in the forest.
427-
More precisely, given an edge `(u, v)` of index `i`,
428-
`reverse_bfs_order[i]` is either `(u, v)` or `(v, u)`.
429-
The first node of the tuple is the leaf in the reverse BFS order.
427+
For a tree index `1 <= k <= nt`, the list
428+
`list = reverse_bfs_order[tree_edge_indices[k]:(tree_edge_indices[k+1]-1)]` is a list of edges
429+
`list[i] = (leaf, inner)` of the `k`th tree such that `leaf` is a leaf of the tree containing
430+
the edges `list[i:end]`.
431+
From an other point of view, `reverse(list)` contains the edges in the order of a breadth first
432+
(BFS) traversal order of the `k`th tree starting from a depth-minimizing root.
430433
"""
431434
reverse_bfs_orders::Vector{Tuple{T,T}}
432435
"For a tree index `1 <= k <= nt`, `is_star[k]` indicates whether the `k`th three is a star."
@@ -436,7 +439,7 @@ struct TreeSet{T}
436439
One can think of it as a kind of fused vector of offsets (similar to the `colptr` field of `SparseMatrixCSC`) of all trees together.
437440
"""
438441
tree_edge_indices::Vector{T}
439-
"numbers of 2-colored trees for which trees sharing the same 2 colors have disjoint vertices"
442+
"numbers of 2-colored trees for which trees sharing the same 2 colors have disjoint edges"
440443
nt::T
441444
end
442445

@@ -579,6 +582,15 @@ function TreeSet(
579582
# Number of edges treated
580583
num_edges_treated = zero(T)
581584

585+
# The `rank` of the `k`th tree encoded in `forest` does not correspond
586+
# to the depth of the tree rooted as the root encoded in `forest` because
587+
# `forest.parents[u] = v` only needs a path to exists from `u` to `v` but
588+
# there may not be an edge `(u, v)`.
589+
# We also want a root `r` that minimizes the depth of the tree rooted at
590+
# `r`. To achieve this, we start from each leaf and remove the corresponding
591+
# edges. We then look at all leaves of the corresponding graphs and repeat
592+
# the process until there is only one vertex left. This vertex will then be
593+
# a depth-minimizing root.
582594
for k in 1:nt
583595
# Initialize the queue to store the leaves
584596
queue_start = 1

0 commit comments

Comments
 (0)