Skip to content

Commit

Permalink
Merge pull request #6 from niklas-uhl/degree-weight
Browse files Browse the repository at this point in the history
Add option to use vertex degree as weight
  • Loading branch information
DanielSeemaier authored Jul 22, 2022
2 parents 6b51904 + f6e6e26 commit adb3727
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/kaminpar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,17 @@ int main(int argc, char *argv[]) {
StaticArray<EdgeWeight> edge_weights;

const io::metis::GraphInfo info = TIMED_SCOPE(TIMER_IO) {
return io::metis::read(ctx.graph_filename, nodes, edges, node_weights, edge_weights);
auto info = io::metis::read(ctx.graph_filename, nodes, edges, node_weights, edge_weights);
if (ctx.degree_weights) {
if (node_weights.size() != nodes.size() - 1) {
node_weights.resize_without_init(nodes.size() - 1);
}
tbb::parallel_for<NodeID>(0, node_weights.size(), [&node_weights, &nodes](const NodeID u) {
node_weights[u] = nodes[u + 1] - nodes[u];
});
info.total_node_weight = nodes.back();
}
return info;
};

START_TIMER(TIMER_PARTITIONING);
Expand Down
1 change: 1 addition & 0 deletions kaminpar/application/arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void create_miscellaneous_context_options(Context &ctx, Arguments &args, const s
.argument("use-interleaved-numa-allocation", "Interleave allocations across NUMA nodes round-robin style.", &ctx.parallel.use_interleaved_numa_allocation)
.argument("fast-ip", "Use cheaper initial partitioning if k is larger than this.", &ctx.partition.fast_initial_partitioning)
.argument("mode", "Partitioning mode, possible values: {" + partitioning_mode_names() + "}.", &ctx.partition.mode, partitioning_mode_from_string)
.argument("degree-weight", "Use node degree as node weight, ignore input weight.", &ctx.degree_weights)
.argument("quiet", "Do not produce any output.", &ctx.quiet, 'q')
;
}
Expand Down
1 change: 1 addition & 0 deletions kaminpar/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ void Context::print(std::ostream &out, const std::string &prefix) const {
<< prefix << "partition_filename=" << partition_filename << " " //
<< prefix << "partition_directory=" << partition_directory << " " //
<< prefix << "ignore_weights=" << ignore_weights << " " //
<< prefix << "degree_weights=" << degree_weights << " " //
<< prefix << "show_local_timers=" << show_local_timers << " " //
<< prefix << "quiet=" << quiet << " "; //

Expand Down
1 change: 1 addition & 0 deletions kaminpar/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ struct Context {
std::string partition_directory{"./"};
std::string partition_filename{};
bool ignore_weights{false};
bool degree_weights{false};
bool show_local_timers{false};
bool quiet{false};

Expand Down

0 comments on commit adb3727

Please sign in to comment.