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

C++ Boost

write_dimacs_max_flow

//outputs a graph with including edge_capacity properties to an std::ostream
template < typename Graph, typename CapacityMap, typename IndexMap >
void write_dimacs_max_flow(Graph& g,
                         CapacityMap capacity,
                         IndexMap idx,
                         typename graph_traits::vertex_descriptor& src,
                         typename graph_traits::vertex_descriptor& sink,
                         std::ostream& out)

This method writes a BGL graph object as an max-flow problem into an output stream in extended dimacs format (see Goldbergs site for more information). The output can be read in again using the boost/graph/read_dimacs.hpp method.

Where Defined

boost/graph/write_dimacs.hpp

Parameters

IN: Graph& g
A directed or undirected graph. The graph's type must be a model of VertexListGraph and EdgeListGraph, as num_vertices(Graph) and num_edges(Graph) is used inside. [1]
IN: CapacityMap capacity
A property map that models Readable Property Map whose key type is the edge descriptor of the graph and whose value type can be written to a stream.
IN: IndexMap epw
A property map that models Readable Property Map whose key type is the vertex descriptor of the graph and whose value type can be written to a stream.
OUT: std::ostream& out
A standard std::ostream object.

Example

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

See Also

read_dimacs

Notes

[1] As num_edges() and num_vertices() is used inside which returns values for the unfiltered graph (instead of the filtered), this method cannot be used with a filtered_graphSee filtered_graph Note [2] for the reason.