1<HTML> 2 3<!-- 4// Copyright (c) 2006, Stephan Diederich 5// 6// This code may be used under either of the following two licences: 7// 8// Permission is hereby granted, free of charge, to any person 9// obtaining a copy of this software and associated documentation 10// files (the "Software"), to deal in the Software without 11// restriction, including without limitation the rights to use, 12// copy, modify, merge, publish, distribute, sublicense, and/or 13// sell copies of the Software, and to permit persons to whom the 14// Software is furnished to do so, subject to the following 15// conditions: 16// 17// The above copyright notice and this permission notice shall be 18// included in all copies or substantial portions of the Software. 19// 20// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27// OTHER DEALINGS IN THE SOFTWARE. OF SUCH DAMAGE. 28// 29// Or: 30// 31// Distributed under the Boost Software License, Version 1.0. 32// (See accompanying file LICENSE_1_0.txt or copy at 33// http://www.boost.org/LICENSE_1_0.txt) 34--> 35 36<Head> 37<Title>Boost Graph Library: write_dimacs_max_flow</Title> 38<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 39 ALINK="#ff0000"> 40<IMG SRC="../../../boost.png" 41 ALT="C++ Boost" width="277" height="86"> 42<BR Clear> 43 44<H1><A NAME="sec:write_dimacs_max_flow"> 45<TT>write_dimacs_max_flow</TT> 46</H1> 47 48 49<pre> 50//outputs a graph with including edge_capacity properties to an std::ostream 51template < typename Graph, typename CapacityMap, typename IndexMap > 52void write_dimacs_max_flow(Graph& g, 53 CapacityMap capacity, 54 IndexMap idx, 55 typename graph_traits<Graph>::vertex_descriptor& src, 56 typename graph_traits<Graph>::vertex_descriptor& sink, 57 std::ostream& out) 58 59</pre> 60 61<p> 62This method writes a BGL graph object as an max-flow problem into an output stream in extended dimacs format (see <a href="https://web.archive.org/web/20120102213028/http://www.avglab.com/andrew/CATS/maxflow_formats.htm"><TT>Goldbergs site</TT></a> for more information). 63The output can be read in again using the <a href="../../../boost/graph/read_dimacs.hpp"><TT>boost/graph/read_dimacs.hpp</TT></a> method. 64 65<H3>Where Defined</H3> 66 67<P> 68<a href="../../../boost/graph/write_dimacs.hpp"><TT>boost/graph/write_dimacs.hpp</TT></a> 69 70<h3>Parameters</h3> 71 IN: <tt>Graph& g</tt> 72<blockquote> 73 A directed or undirected graph. The graph's type must be a model of 74 <a href="./VertexListGraph.html">VertexListGraph</a> and <a href="./EdgeListGraph.html">EdgeListGraph</a>, as num_vertices(Graph) and num_edges(Graph) is used inside. <a href="#1">[1]</a> 75</blockquote> 76 77 IN: <tt>CapacityMap capacity</tt> 78<blockquote> 79 A property map that models <a href="../../property_map/doc/ReadablePropertyMap.html">Readable Property Map</a> whose key type is the edge descriptor of the graph and whose value type can be written to a stream. <br> 80</blockquote> 81 82 IN: <tt>IndexMap epw</tt> 83<blockquote> 84 A property map that models <a href="../../property_map/doc/ReadablePropertyMap.html">Readable Property Map</a> whose key type is the vertex descriptor of the graph and whose value type can be written to a stream. <br> 85</blockquote> 86 87 OUT: <tt>std::ostream& out</tt> 88<blockquote> 89 A standard <tt>std::ostream</tt> object. 90</blockquote> 91 92<H3> 93Example 94</H3> 95A short <a href="../example/read_write_dimacs-eg.cpp">example</a> which uses read_dimacs and write_dimacs is located in the examples directory. 96 97<h3>See Also</h3> 98 99<a href="./read_dimacs.html"><tt>read_dimacs</tt></a> 100 101<h3>Notes</h3> 102<a name="1">[1]</a> 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 <a href="./filtered_graph.html">filtered_graph</a>See <a href="./filtered_graph.html#2">filtered_graph Note [2]</a> for the reason. 103</BODY> 104</HTML> 105