MCPcopy Create free account
hub / github.com/KaHIP/KaHIP / main

Function main

app/fast_node_ordering.cpp:24–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22#include "tools/timer.h"
23
24int main(int argn, char **argv) {
25 PartitionConfig partition_config;
26 std::string graph_filename;
27
28 bool is_graph_weighted = false;
29 bool suppress_output = false;
30 bool recursive = false;
31
32 int ret_code = parse_parameters(argn, argv,
33 partition_config,
34 graph_filename,
35 is_graph_weighted,
36 suppress_output, recursive);
37
38 if (ret_code) {
39 return 0;
40 }
41
42 // Backup stdout
43 std::streambuf* backup = std::cout.rdbuf();
44 if(suppress_output) {
45 std::cout.rdbuf(nullptr);
46 }
47
48 graph_access input_graph;
49
50 timer t;
51 graph_io::readGraphWeighted(input_graph, graph_filename);
52 std::cout << "io time: " << t.elapsed() << std::endl;
53
54 // Make input_graph unweighted
55 bool has_node_weights = false;
56 forall_nodes(input_graph, node) {
57 if (input_graph.getNodeWeight(node) != 1) {
58 has_node_weights = true;
59 }
60 input_graph.setNodeWeight(node, 1);
61 } endfor
62 if (has_node_weights) {
63 std::cout << "There were nodes with weight != 1" << std::endl;
64 }
65 std::cout << "graph has " << input_graph.number_of_nodes() << " nodes and "
66 << input_graph.number_of_edges() << " edges" << std::endl;
67
68 timer full_nd_timer;
69 full_nd_timer.restart();
70 t.restart();
71 // 'active_graph' is the graph to use after reductions have been applied.
72 // If no reductions have been applied, 'active_graph' points to 'input_graph'.
73 // Otherwise, it points to 'reduction_stack.back()->get_reduced_graph()'.
74 graph_access *active_graph;
75 std::vector<std::unique_ptr<Reduction>> reduction_stack;
76 bool used_reductions = apply_reductions(partition_config, input_graph, reduction_stack);
77 if (used_reductions) {
78 active_graph = &reduction_stack.back()->get_reduced_graph();
79 } else {
80 active_graph = &input_graph;
81 }

Callers

nothing calls this directly

Calls 13

apply_reductionsFunction · 0.85
map_orderingFunction · 0.85
print_orderingFunction · 0.85
compute_fillFunction · 0.85
parse_parametersFunction · 0.70
forall_nodesFunction · 0.70
forall_edgesFunction · 0.50
elapsedMethod · 0.45
number_of_nodesMethod · 0.45
number_of_edgesMethod · 0.45
restartMethod · 0.45
get_first_edgeMethod · 0.45

Tested by

no test coverage detected