Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Aug 8, 2024
1 parent e5f82b0 commit df82ca5
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/decompression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,18 +372,18 @@ function decompress_acyclic!(

# to be optimized!
set_roots = Set{Int}()
roots = Int[]
ntrees = 0
for edge in tree_set.disjoint_sets.revmap
# ensure that all paths are compressed
root_edge = find_root!(disjoint_sets, edge)
root_index = tree_set.disjoint_sets.intmap[root_edge]
push!(roots, root_index)

# we exclude trees related to diagonal coefficients
if (edge[1] != edge[2])
push!(set_roots, root_index)
end
end
roots = disjoint_sets.internal.parents

# DEBUG
println(set_roots)
Expand All @@ -400,16 +400,14 @@ function decompress_acyclic!(
end
end
end
for k in 1:ntrees
nedges = length(trees[k])
if nedges > 1
tree_edges = trees[k]
tree_ranks = view(disjoint_sets.internal.ranks, tree_edges)
p = sortperm(tree_ranks)
trees[k] = tree_edges[p]
display(disjoint_sets.internal.ranks[trees[k]])
end
end
# for k in 1:ntrees
# nedges = length(trees[k])
# if nedges > 1
# tree_edges = trees[k]
# p = ...
# trees[k] = tree_edges[p]
# end
# end

# DEBUG
display(trees)
Expand Down Expand Up @@ -439,7 +437,7 @@ function decompress_acyclic!(
stored_values[i] = zero(R)
stored_values[j] = zero(R)
end
for edge_index in tree # edges are sorted by their rank using disjoint_sets.internal.rank
for edge_index in tree # edges are sorted by their distance to the root
i, j = disjoint_sets.revmap[edge_index]
parent_index = disjoint_sets.internal.parents[edge_index]
k, l = disjoint_sets.revmap[parent_index]
Expand Down

0 comments on commit df82ca5

Please sign in to comment.