/*! \file gklib.c \brief Functions for printing various statistics for the computed partitionings and orderings. \date Started 7/25/1997 \author George \author Copyright 1997-2009, Regents of the University of Minnesota \version\verbatim $Id: stat.c 10046 2011-06-01 14:13:40Z karypis $ \endverbatim */ #include "metisbin.h" /****************************************************************************/ /*! This function computes various information associated with a partition */ /****************************************************************************/ void ComputePartitionInfo(params_t *params, graph_t *graph, idx_t *where) { idx_t i, ii, j, k, nvtxs, ncon, nparts, tvwgt; idx_t *xadj, *adjncy, *vwgt, *adjwgt, *kpwgts; real_t *tpwgts, unbalance; idx_t pid, ndom, maxndom, minndom, tndom, *pptr, *pind, *pdom; idx_t ncmps, nover, *cptr, *cind, *cpwgts; nvtxs = graph->nvtxs; ncon = graph->ncon; xadj = graph->xadj; adjncy = graph->adjncy; vwgt = graph->vwgt; adjwgt = graph->adjwgt; nparts = params->nparts; tpwgts = params->tpwgts; /* Compute objective-related infomration */ printf(" - Edgecut: %"PRIDX", communication volume: %"PRIDX".\n\n", ComputeCut(graph, where), ComputeVolume(graph, where)); /* Compute constraint-related information */ kpwgts = ismalloc(ncon*nparts, 0, "ComputePartitionInfo: kpwgts"); for (i=0; i 0 ? 1 : 0); tndom += ndom; if (pid == 0 || maxndom < ndom) maxndom = ndom; if (pid == 0 || minndom > ndom) minndom = ndom; } printf(" - Subdomain connectivity: max: %"PRIDX", min: %"PRIDX", avg: %.2"PRREAL"\n\n", maxndom, minndom, 1.0*tndom/nparts); gk_free((void **)&pptr, &pind, &pdom, LTERM); /* Compute subdomain adjacency information */ cptr = imalloc(nvtxs+1, "ComputePartitionInfo: cptr"); cind = imalloc(nvtxs, "ComputePartitionInfo: cind"); cpwgts = ismalloc(nparts, 0, "ComputePartitionInfo: cpwgts"); ncmps = FindPartitionInducedComponents(graph, where, cptr, cind); if (ncmps == nparts) printf(" - Each partition is contiguous.\n"); else { if (IsConnected(graph, 0)) { for (nover=0, i=0; i