ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Metis.h File Reference

The partitions of METIS (https://github.com/KarypisLab/METIS) of a StaticGraph, beyond the book: partition( g , k , o ) calls METIS_PartGraphKway(), or METIS_PartGraphRecursive() when o.recursive, on the compressed rows of \( g \), and gives back a Partition [see interop/Csr.h], the part of each node and the weight of the edges cut, whose order() relabels the graph part by part through StaticGraph::relabel(). More...

#include "ADS/Contract.h"
#include "ADS/graph/StaticGraph.h"
#include "ADS/interop/Csr.h"
#include <metis.h>
#include <cstddef>
#include <stdexcept>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  ADS::metis::Options
 the options of a partition by METIS More...

Namespaces

namespace  ADS
namespace  ADS::metis

Typedefs

using ADS::metis::Input = CsrInput< idx_t , idx_t >
 the arrays of a graph for METIS: in place where the layouts agree

Functions

template<class G>
Partition ADS::metis::partition (const G &g, const Input &I, int k, const Options &o=Options())
 the partition of the nodes of \( g \) into \( k \) parts by METIS, on the input \( I \) of \( g \) (whose arrays it reads in place, or the copies of CsrInput)
template<class G>
Partition ADS::metis::partition (const G &g, int k, const Options &o=Options())
 the partition of the nodes of \( g \) into \( k \) parts by METIS, on the rows of \( g \) read in place where the layouts agree

Detailed description

The partitions of METIS (https://github.com/KarypisLab/METIS) of a StaticGraph, beyond the book: partition( g , k , o ) calls METIS_PartGraphKway(), or METIS_PartGraphRecursive() when o.recursive, on the compressed rows of \( g \), and gives back a Partition [see interop/Csr.h], the part of each node and the weight of the edges cut, whose order() relabels the graph part by part through StaticGraph::relabel().

The rows of a StaticGraph are those of METIS, xadj the offsets and adjncy the heads, both arcs of an edge of an unoriented graph present: when idx_t is int (the 32-bit build of METIS, that of the distributions) and the graph is of the separate layout, METIS reads offsets() and heads() in place, and the weights of weightData() as adjwgt if they are of the type idx_t too; it reads every other layout through a copy [see CsrInput]: a 64-bit idx_t (copies of the offsets and of the heads), weights of another type (a copy of them, converted to idx_t), an interleaved graph (a copy of its heads and of its weights). METIS takes its arrays as pointers to non-constant data but writes none of them with the numbering of C, which partition() sets.

ADS has no partitioner of graphs, and this header gives none: it lets METIS run on the graphs of ADS, whose rows it shares.

This header is of the set interop: no entry point of ADS includes it, and it needs METIS 5, found by CMake when ADS_WITH_METIS is AUTO or ON (the target ADS::METIS). The contracts [see Contract.h]: the graph is unoriented, without loops, with positive integral weights if any; \( 1 \le k \le n \); a failure of METIS throws std::runtime_error.

See also
G. Karypis, V. Kumar, A fast and high quality multilevel scheme for partitioning irregular graphs, SIAM Journal on Scientific Computing 20(1), 359-392, 1998, doi:10.1137/S1064827595287997
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa