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

Function main

misc/example_library_call/interface_test.cpp:14–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13
14int main(int argn, char **argv) {
15
16 std::cout << "partitioning graph from the manual" << std::endl;
17
18 int n = 5;
19 kahip_idx* xadj = new kahip_idx[6];
20 xadj[0] = 0; xadj[1] = 2; xadj[2] = 5; xadj[3] = 7; xadj[4] = 9; xadj[5] = 12;
21
22 kahip_idx* adjncy = new kahip_idx[12];
23 adjncy[0] = 1; adjncy[1] = 4; adjncy[2] = 0; adjncy[3] = 2; adjncy[4] = 4; adjncy[5] = 1;
24 adjncy[6] = 3; adjncy[7] = 2; adjncy[8] = 4; adjncy[9] = 0; adjncy[10] = 1; adjncy[11] = 3;
25
26 double imbalance = 0.03;
27 int* part = new int[n];
28 kahip_idx edge_cut = 0;
29 int nparts = 2;
30 int* vwgt = NULL;
31 kahip_idx* adjcwgt = NULL;
32
33 //void kaffpa(int* n, int* vwgt, int* xadj,
34 //int* adjcwgt, int* adjncy, int* nparts,
35 //double* imbalance, bool suppress_output, int seed, int mode,
36 //int* edgecut, int* part);
37
38 kaffpa(&n, vwgt, xadj, adjcwgt, adjncy, &nparts, &imbalance, false, 0, ECO, & edge_cut, part);
39
40 std::cout << "edge cut " << edge_cut << std::endl;
41
42 //void process_mapping(int* n, int* vwgt, int* xadj,
43 //int* adjcwgt, int* adjncy,
44 //int* hierarchy_parameter, int* distance_parameter, int hierarchy_depth,
45 //int mode_partitioning, int mode_mapping,
46 //double* imbalance,
47 //bool suppress_output, int seed,
48 //int* edgecut, int* qap, int* part);
49
50 int* hierarchy_parameter = new int[2];
51 int* distance_parameter = new int[2];
52 hierarchy_parameter[0] = 2;
53 hierarchy_parameter[1] = 2;
54 distance_parameter[0] = 1;
55 distance_parameter[1] = 100;
56 int qap = 0;
57
58 process_mapping(&n, vwgt, xadj, adjcwgt, adjncy, hierarchy_parameter, distance_parameter, 2, STRONG, MAPMODE_MULTISECTION, &imbalance, false, 0, & edge_cut, & qap, part);
59
60 std::cout << "edge cut " << edge_cut << std::endl;
61 std::cout << "qap " << qap << std::endl;
62
63}

Callers

nothing calls this directly

Calls 2

process_mappingFunction · 0.85
kaffpaFunction · 0.50

Tested by

no test coverage detected