3 // Copyright (c) 2006, Stephan Diederich
4 // Copyright (c) 2010, Trustees of Indiana University
6 // This code may be used under either of the following two licences:
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
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
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.
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)
36 <Title>Boost Graph Library: read_dimacs_max_flow and read_dimacs_min_cut
</Title>
37 <BODY BGCOLOR=
"#ffffff" LINK=
"#0000ee" TEXT=
"#000000" VLINK=
"#551a8b"
39 <IMG SRC=
"../../../boost.png"
40 ALT=
"C++ Boost" width=
"277" height=
"86">
43 <H1><A NAME=
"sec:read_dimacs_max_flow">
44 <TT>read_dimacs_max_flow
</TT>
49 //reads a graph with attached edge_capacity properties from an std::istream
50 template
<class Graph, class CapacityMap, class ReverseEdgeMap
>
51 int read_dimacs_max_flow(Graph
& g,
53 ReverseEdgeMap reverse_edge,
54 typename graph_traits
<Graph>::vertex_descriptor
& src,
55 typename graph_traits
<Graph>::vertex_descriptor
& sink,
56 std::istream
& in=std::cin)
58 //reads a graph with attached edge_capacity properties from an std::istream
59 template
<class Graph, class CapacityMap, class ReverseEdgeMap
>
60 int read_dimacs_min_cut(Graph
& g,
62 ReverseEdgeMap reverse_edge,
63 std::istream
& in=std::cin)
68 These functions read a BGL graph object from a max-flow or min-cut problem description in extended dimacs format. (see
<a href=
"http://www.avglab.com/andrew/CATS/maxflow_formats.htm"><TT>Goldberg's site
</TT></a> for more information). For each edge found in the
69 file an additional reverse_edge is added and set in the reverse_edge map. For
70 max-flow problems, source and sink vertex descriptors are set according to the
73 <H3>Where Defined
</H3>
76 <a href=
"../../../boost/graph/read_dimacs.hpp"><TT>boost/graph/read_dimacs.hpp
</TT></a>
79 IN:
<tt>Graph
& g
</tt>
81 A directed or undirected graph. The graph's type must be a model of
<a href=
"./IncidenceGraph.html">IncidenceGraph
</a>.
84 OUT:
<tt>CapacityMap capacity
</tt>
86 A property map that models
<a href=
"../../property_map/doc/LvaluePropertyMap.html">mutable Lvalue Property Map
</a> whose key type is the edge descriptor of the graph.
<br>
89 OUT:
<tt>ReverseEdgeMap reverse_edge
</tt>
91 A property map that models
<a href=
"../../property_map/doc/LvaluePropertyMap.html">mutable Lvalue Property Map
</a> 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.
<br>
94 OUT:
<tt>vertex_descriptor
& src
</tt>
96 A graph vertex that will be set to the source of a max-flow problem.
99 OUT:
<tt>vertex_descriptor
& sink
</tt>
101 A graph vertex that will be set to the sink of a max-flow problem.
104 IN:
<tt>std::istream
& in
</tt>
106 A standard
<tt>std::istream
</tt> object.
<br>
107 <b>Default
</b>:
<tt>std::cin (for backward compatibility)
</tt>
113 A short
<a href=
"../example/read_write_dimacs-eg.cpp">example
</a> which uses read_dimacs and write_dimacs is located in the examples directory.
117 <a href=
"./write_dimacs.html"><tt>write_dimacs
</tt></a>