diff --git a/src/decompression.jl b/src/decompression.jl index 6b127fa..005fe8f 100644 --- a/src/decompression.jl +++ b/src/decompression.jl @@ -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) @@ -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) @@ -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]