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

Function main

app/node_ordering.cpp:25–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23#include "tools/random_functions.h"
24
25int main(int argn, char **argv) {
26 PartitionConfig partition_config;
27 std::string graph_filename;
28
29 bool is_graph_weighted = false;
30 bool suppress_output = false;
31 bool recursive = false;
32
33 int ret_code = parse_parameters(argn, argv,
34 partition_config,
35 graph_filename,
36 is_graph_weighted,
37 suppress_output, recursive);
38
39 if (ret_code) {
40 return 0;
41 }
42
43 // Backup stdout
44 std::streambuf* backup = std::cout.rdbuf();
45 if(suppress_output) {
46 std::cout.rdbuf(nullptr);
47 }
48
49 graph_access G;
50
51 timer t;
52 graph_io::readGraphWeighted(G, graph_filename);
53 std::cout << "io time: " << t.elapsed() << std::endl;
54
55 // Make G unweighted
56 bool has_node_weights = false;
57 forall_nodes(G, node) {
58 if (G.getNodeWeight(node) != 1) {
59 has_node_weights = true;
60 }
61 G.setNodeWeight(node, 1);
62 } endfor
63 if (has_node_weights) {
64 std::cout << "There were nodes with weight != 1" << std::endl;
65 }
66
67 std::cout << "imbalance is set to " << partition_config.imbalance << "%" << std::endl;
68 balance_configuration bc;
69 bc.configurate_balance(partition_config, G);
70
71 srand(partition_config.seed);
72 random_functions::setSeed(partition_config.seed);
73
74 std::cout << "graph has " << G.number_of_nodes() << " nodes and " << G.number_of_edges() << " edges" << std::endl;
75
76 t.restart();
77 nested_dissection dissection(&G);
78 dissection.perform_nested_dissection(partition_config);
79
80 // Restore cout output stream
81 std::cout.rdbuf(backup);
82

Callers

nothing calls this directly

Calls 9

compute_fillFunction · 0.85
print_orderingFunction · 0.85
configurate_balanceMethod · 0.80
parse_parametersFunction · 0.70
elapsedMethod · 0.45
number_of_nodesMethod · 0.45
number_of_edgesMethod · 0.45
restartMethod · 0.45

Tested by

no test coverage detected