DIMACS Format
The same group on the Doxygen site.
- group DIMACS Format
Read and write files in DIMACS format.
Tools to read a digraph from or write it to a file in DIMACS format data.
Classes
Class |
Description |
|---|---|
DIMACS file type descriptor. |
Functions and other members
-
inline DimacsDescriptor dimacsType( std::istream & is )
Discover the type of a DIMACS file.
This function starts seeking the beginning of the given file for the problem type and size info. The found data is returned in a special struct that can be evaluated and passed to the appropriate reader function.
-
template< typename Digraph , typename LowerMap , typename CapacityMap , typename CostMap , typename SupplyMap >
void readDimacsMin( - std::istream & is,
- Digraph & g,
- LowerMap & lower,
- CapacityMap & capacity,
- CostMap & cost,
- SupplyMap & supply,
- typename CapacityMap::Value infty = 0,
- DimacsDescriptor desc = DimacsDescriptor()
DIMACS minimum cost flow reader function.
This function reads a minimum cost flow instance from DIMACS format, i.e. from a DIMACS file having a line starting with
At the beginning,p min
gis cleared byg.clear(). The supply amount of the nodes are written to thesupplynode map (they are signed values). The lower bounds, capacities and costs of the arcs are written to thelower,capacityandcostarc maps.If the capacity of an arc is less than the lower bound, it will be set to “infinite” instead. The actual value of “infinite” is contolled by the
inftyparameter. If it is 0 (the default value),std::numeric_limits< Capacity >::infinity()will be used if available,(std::numeric_limits< Capacity >::max)() otherwise. Ifinftyis set to a non-zero value, that value will be used as “infinite”.If the file type was previously evaluated by dimacsType(), then the descriptor struct should be given by the
descparameter.
-
template< typename Digraph , typename CapacityMap >
void _readDimacs( - std::istream & is,
- Digraph & g,
- CapacityMap & capacity,
- typename Digraph::Node & s,
- typename Digraph::Node & t,
- typename CapacityMap::Value infty = 0,
- DimacsDescriptor desc = DimacsDescriptor()
-
template< typename Digraph , typename CapacityMap >
void readDimacsMax( - std::istream & is,
- Digraph & g,
- CapacityMap & capacity,
- typename Digraph::Node & s,
- typename Digraph::Node & t,
- typename CapacityMap::Value infty = 0,
- DimacsDescriptor desc = DimacsDescriptor()
DIMACS maximum flow reader function.
This function reads a maximum flow instance from DIMACS format, i.e. from a DIMACS file having a line starting with
At the beginning,p max
gis cleared byg.clear(). The arc capacities are written to thecapacityarc map andsandtare set to the source and the target nodes.If the capacity of an arc is negative, it will be set to “infinite” instead. The actual value of “infinite” is contolled by the
inftyparameter. If it is 0 (the default value),std::numeric_limits< Capacity >::infinity()will be used if available,(std::numeric_limits< Capacity >::max)() otherwise. Ifinftyis set to a non-zero value, that value will be used as “infinite”.If the file type was previously evaluated by dimacsType(), then the descriptor struct should be given by the
descparameter.
-
template< typename Digraph , typename LengthMap >
void readDimacsSp( - std::istream & is,
- Digraph & g,
- LengthMap & length,
- typename Digraph::Node & s,
- DimacsDescriptor desc = DimacsDescriptor()
DIMACS shortest path reader function.
This function reads a shortest path instance from DIMACS format, i.e. from a DIMACS file having a line starting with
At the beginning,p sp
gis cleared byg.clear(). The arc lengths are written to thelengtharc map andsis set to the source node.If the file type was previously evaluated by dimacsType(), then the descriptor struct should be given by the
descparameter.
-
template< typename Digraph , typename CapacityMap >
void readDimacsCap( - std::istream & is,
- Digraph & g,
- CapacityMap & capacity,
- typename CapacityMap::Value infty = 0,
- DimacsDescriptor desc = DimacsDescriptor()
DIMACS capacitated digraph reader function.
This function reads an arc capacitated digraph instance from DIMACS ‘max’ or ‘sp’ format. At the beginning,
gis cleared byg.clear()and the arc capacities/lengths are written to thecapacityarc map.In case of the ‘max’ format, if the capacity of an arc is negative, it will be set to “infinite” instead. The actual value of “infinite” is contolled by the
inftyparameter. If it is 0 (the default value),std::numeric_limits< Capacity >::infinity()will be used if available,(std::numeric_limits< Capacity >::max)() otherwise. Ifinftyis set to a non-zero value, that value will be used as “infinite”.If the file type was previously evaluated by dimacsType(), then the descriptor struct should be given by the
descparameter.
-
template< typename Graph >
enable_if< lemon::UndirectedTagIndicator< Graph > , void >::type _addArcEdge(
)
-
template< typename Graph >
disable_if< lemon::UndirectedTagIndicator< Graph > , void >::type _addArcEdge(
)
-
template< typename Graph >
void readDimacsMat( - std::istream & is,
- Graph & g,
- DimacsDescriptor desc = DimacsDescriptor()
DIMACS plain (di)graph reader function.
This function reads a plain (di)graph without any designated nodes and maps (e.g. a matching instance) from DIMACS format, i.e. from DIMACS files having a line starting with
At the beginning,p mat
gis cleared byg.clear().If the file type was previously evaluated by dimacsType(), then the descriptor struct should be given by the
descparameter.
-
template< typename Digraph >
void writeDimacsMat( - std::ostream & os,
- const Digraph & g,
- std::string comment = ""
DIMACS plain digraph writer function.
This function writes a digraph without any designated nodes and maps into DIMACS format, i.e. into DIMACS file having a line starting with
Ifp mat
commentis not empty, then it will be printed in the first line prefixed by ‘c’.