Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/KarypisLab/METIS/llms.txt

Use this file to discover all available pages before exploring further.

METIS ships three utility programs alongside its main partitioning tools. m2gmetis converts a mesh file into a METIS graph file without partitioning it; graphchk validates that a graph file conforms to the METIS format; and cmpfillin computes the fill-in statistics for an externally-supplied vertex ordering. All three are built and installed alongside gpmetis, ndmetis, and mpmetis.

m2gmetis — Mesh to Graph Converter

m2gmetis converts a finite element mesh file into a METIS-format graph file. It uses the same dual and nodal graph construction logic as mpmetis, but writes the resulting graph to disk instead of partitioning it. This is useful when you want to inspect the graph, use it with gpmetis, or supply it to a custom partitioner.

Usage

m2gmetis [options] meshfile graphfile
ArgumentDescription
meshfilePath to the input mesh file (METIS mesh format).
graphfilePath where the output graph file will be written.

Examples

# Generate the dual graph (default) from a mesh
m2gmetis graphs/metis.mesh output/metis_dual.graph

Output Format

The output is a standard METIS graph file (the same format accepted by gpmetis and ndmetis). The first line contains the number of vertices and edges; subsequent lines list each vertex’s adjacency.
  • For a dual graph (-gtype=dual): each vertex represents one mesh element.
  • For a nodal graph (-gtype=nodal): each vertex represents one mesh node.

Options

gtype
string
default:"dual"
Specifies which graph representation to generate from the mesh.
ValueDescription
dualGenerate the dual graph (one vertex per element) (default)
nodalGenerate the nodal graph (one vertex per mesh node)
ncommon
integer
default:"1"
Applies only when -gtype=dual. The minimum number of shared mesh nodes required for two elements to be connected in the dual graph. Must be ≥ 1.
For triangular meshes, -ncommon=2 connects elements that share an edge. For tetrahedral meshes, -ncommon=3 connects elements that share a face.
dbglvl
integer
default:"0"
Debug verbosity level. Set to 0 for no debug output (default).

Build docs developers (and LLMs) love