#include #include #include "metis-5.1.0/include/metis.h" // to compile: gcc -O3 -o metisDriver metisDriver.c -L./metis-5.1.0/build/Linux-x86_64/libmetis -lmetis -lm // to run: ./metisDriver int main(int argc, char **argv){ // set up a grid int N = 20, id, sk, nedges; idx_t nvtxs = N*N; idx_t ncon = 1; idx_t *vwgt = NULL; idx_t *vsize = NULL; idx_t *adjwgt = NULL; real_t *tpwgts = NULL; real_t *ubvec = NULL; idx_t *options = NULL; idx_t objval; idx_t nparts = 5; // will request partitions int n,m; // count connections for cartesian network nedges = 0; for(n=0;n0) ++nedges; if(m0) ++nedges; if(n0) adjncy[nedges++] = m-1+n*N; if(m0) adjncy[nedges++] = m+(n-1)*N; if(n