Documentation Index
Fetch the complete documentation index at: https://mintlify.com/KarypisLab/ParMETIS/llms.txt
Use this file to discover all available pages before exploring further.
ParMETIS_V3_PartKway is the primary partitioning routine in ParMETIS. It takes a distributed graph stored in CSR format across MPI processes and computes a balanced k-way partition using the multilevel k-way algorithm. The function supports multiple balancing constraints, non-uniform target partition weights, and per-constraint imbalance tolerances, making it suitable for a wide range of scientific computing workloads.
Parameters
Distribution of vertices across processes.
vtxdist[i] is the global index of the first vertex on process i, and vtxdist[i+1] - vtxdist[i] is the number of local vertices. Size npes + 1; must be identical on all processes.Local adjacency row pointers in CSR format.
xadj[i] is the index into adjncy where the adjacency list of local vertex i begins. Size local_nvtxs + 1.Local adjacency column indices in CSR format. Contains the global indices of all neighbors of each local vertex. Size
xadj[local_nvtxs].Vertex weights. There are
ncon weight values per vertex stored in interleaved order: [w0_c0, w0_c1, ..., w1_c0, w1_c1, ...]. May be NULL when bit 1 of wgtflag is 0.Edge weights, one value per entry in
adjncy. May be NULL when bit 0 of wgtflag is 0.Bitmask controlling which weights are used. Bit 0 (value 1): use
adjwgt. Bit 1 (value 2): use vwgt. Combined values: 0 = no weights, 1 = edge weights only, 2 = vertex weights only, 3 = both.Indexing convention.
0 for C-style 0-based indexing; 1 for Fortran-style 1-based indexing.Number of balancing constraints per vertex. Each vertex carries
ncon weight values, and the partition is balanced with respect to all ncon constraints simultaneously.Desired number of partitions. Does not need to equal the number of MPI processes.
Target partition weights. Array of
nparts * ncon values. tpwgts[i * ncon + j] is the desired fraction of constraint j’s total weight assigned to partition i. All values for a given constraint must sum to 1.0. Pass NULL to request equal-sized partitions.Per-constraint imbalance tolerance. Array of
ncon values. ubvec[i] = 1.05 allows up to 5% imbalance for constraint i. Must be greater than 1.0 for all entries.Algorithm options. If
options[0] = 0, all defaults are used. If options[0] = 1, additional entries are read: options[PMV3_OPTION_DBGLVL] (index 1) sets the debug level, and options[PMV3_OPTION_SEED] (index 2) sets the random number seed.Output. Total weight of edges whose endpoints are assigned to different partitions. Written on all processes.
Output. Partition assignment for each local vertex.
part[i] is the partition ID (0 to nparts - 1) of local vertex i. The caller must allocate this array with at least local_nvtxs elements.Pointer to the MPI communicator covering all participating processes.
Return value
ReturnsMETIS_OK (1) on success. Any other value indicates an error.