Skip to content

Commit

Permalink
laziness factor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Rosch committed Feb 14, 2025
1 parent fc8af15 commit d4a505b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions kaminpar-cli/kaminpar_arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ CLI::Option_group *create_coarsening_options(CLI::App *app, Context &ctx) {
new number of edges <= factor * old number of edges
The default is infinity.)"
);
coarsening->add_option("--s-laziness-factor", ctx.sparsification.laziness_factor)
->default_val(1.)
->description(R"(Only sparsify if the number of edges times the laziness factor are less than the target.
Thus greater laziness leads to less sparsification. The default is 1.)");


coarsening->add_flag("--s-no-approx", ctx.sparsification.no_approx)
Expand Down
2 changes: 1 addition & 1 deletion kaminpar-shm/coarsening/sparsifing_cluster_coarsener.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ bool SparsifyingClusteringCoarsener::coarsen() {
);
}

if (coarsened->get().m() > target_edge_amount) { // sparsify
if (coarsened->get().m() > _s_ctx.laziness_factor * target_edge_amount) { // sparsify
KASSERT(coarsened->get().m() % 2 == 0, "graph should be undirected", assert::always);

const CSRGraph *csr = dynamic_cast<const CSRGraph *>(coarsened->get().underlying_graph());
Expand Down
1 change: 1 addition & 0 deletions kaminpar-shm/kaminpar.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ struct SparsificationContext {

float density_target_factor;
float reduction_target_factor;
float laziness_factor;

bool no_approx;

Expand Down

0 comments on commit d4a505b

Please sign in to comment.