Class METISParser

Class Documentation

class METISParser

Public Functions

METISParser(std::string_view path)

Constructor for the METIS Parser.

Parameters:

path – [in] file path

std::tuple<count, count, index, count> getHeader()

Get the METIS graph file header

bool hasNext()

Test if graph file has a next line.

template<class NodeT = node>
inline std::vector<NodeT> getNext(count ignoreFirst = 0)

Get adjacencies from the next line in the METIS graph file. The node ids are parsed directly into NodeT, and are 1-based as in the file.

Parameters:

ignoreFirst – [in] number of values to ignore [in case the METIS file contains node weightes]

Throws:

std::runtime_error – if the line is malformed or a node id is not a valid NodeT.

template<class NodeT = node, class EdgeWeightT = edgeweight>
std::vector<std::pair<NodeT, EdgeWeightT>> getNextWithWeights(count ignoreFirst = 0)

Get adjacencies with edge weights from the next line in the METIS graph file. The node ids are parsed directly into NodeT, and are 1-based as in the file. The weights are parsed directly into EdgeWeightT.

Parameters:

ignoreFirst – [in] number of values to ignore [in case the METIS file contains node weightes]

Throws:

std::runtime_error – if the line is malformed, a node id is not a valid NodeT, or a weight is not a valid EdgeWeightT.