Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
C++ Boost

read_dimacs_max_flow

//reads a graph with attached edge_capacity properties from an std::istream
template <class Graph, class CapacityMap, class ReverseEdgeMap>
int read_dimacs_max_flow(Graph& g,
                         CapacityMap capacity, 
                         ReverseEdgeMap reverse_edge,
                         typename graph_traits::vertex_descriptor& src,
                         typename graph_traits::vertex_descriptor& sink,
                         std::istream& in=std::cin)

//reads a graph with attached edge_capacity properties from an std::istream
template <class Graph, class CapacityMap, class ReverseEdgeMap>
int read_dimacs_min_cut(Graph& g,
                        CapacityMap capacity, 
                        ReverseEdgeMap reverse_edge,
                        std::istream& in=std::cin)

These functions read a BGL graph object from a max-flow or min-cut problem description in extended dimacs format. (see Goldberg's site for more information). For each edge found in the file an additional reverse_edge is added and set in the reverse_edge map. For max-flow problems, source and sink vertex descriptors are set according to the dimacs file.

Where Defined

boost/graph/read_dimacs.hpp

Parameters

IN: Graph& g
A directed or undirected graph. The graph's type must be a model of IncidenceGraph.
OUT: CapacityMap capacity
A property map that models mutable Lvalue Property Map whose key type is the edge descriptor of the graph.
OUT: ReverseEdgeMap reverse_edge
A property map that models mutable Lvalue Property Map whose key and value type is the edge descriptor of the graph. This map stores the corresponding reverse edge for each each in Graph g.
OUT: vertex_descriptor& src
A graph vertex that will be set to the source of a max-flow problem.
OUT: vertex_descriptor& sink
A graph vertex that will be set to the sink of a max-flow problem.
IN: std::istream& in
A standard std::istream object.
Default: std::cin (for backward compatibility)

Example

A short example which uses read_dimacs and write_dimacs is located in the examples directory.

See Also

write_dimacs