neighbors_to_metis_graph, a Fortran90 code which reads a file describing the graph-theoretic adjacency structure of the elements in a mesh of triangles or tetrahedrons and writes out a file for input to the mesh partitioning program metis().
Since we know we are dealing with a triangle or tet mesh, each "node" of the adjacency graph has 3 or 4 potential edges. If a potential edge is not used (in other words, if a face is a boundary face), then by convention we write out a "-1" for the neighbor value. Otherwise, the adjacency information lists the index of the element that is a neighbor on that face of the element
Converting to a metis() GRAPH format is trivial. We include an initial line that lists the number of "nodes" (elements) and "edges" (interfaces between pairs of elements), followed by, for each node (element), a list of the adjacent nodes (a list of the adjacent elements, omitting the "-1" values). A cross-eyed schoolboy sitting on a tack would be able to carry out this task!
The information on this web page is distributed under the MIT license.
neighbors_to_metis_graph is available in a C++ version and a Fortran90 version and a MATLAB version and an Octave version.
metis, a C code which partitions the nodes of a graph or the elements of a mesh, for division among a number of parallel processes, or to reorder the variables in a sparse matrix to minimize fillin;
metis_graph, a data directory which contains examples of GRAPH files, to be read by metis(), which can partition a graph;
tet_mesh_tet_neighbors, a Fortran90 code which reads information about a tet mesh and writes out a list of the tetrahedrons that are adjacent to a given tetrahedron;
triangulation_triangle_neighbors, a Fortran90 code which reads data defining a triangulation, determines the neighboring triangles of each triangle, and writes that information to a file.