write_dimacs.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <HTML>
  2. <!--
  3. // Copyright (c) 2006, Stephan Diederich
  4. //
  5. // This code may be used under either of the following two licences:
  6. //
  7. // Permission is hereby granted, free of charge, to any person
  8. // obtaining a copy of this software and associated documentation
  9. // files (the "Software"), to deal in the Software without
  10. // restriction, including without limitation the rights to use,
  11. // copy, modify, merge, publish, distribute, sublicense, and/or
  12. // sell copies of the Software, and to permit persons to whom the
  13. // Software is furnished to do so, subject to the following
  14. // conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be
  17. // included in all copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  21. // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  23. // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  24. // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  25. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  26. // OTHER DEALINGS IN THE SOFTWARE. OF SUCH DAMAGE.
  27. //
  28. // Or:
  29. //
  30. // Distributed under the Boost Software License, Version 1.0.
  31. // (See accompanying file LICENSE_1_0.txt or copy at
  32. // http://www.boost.org/LICENSE_1_0.txt)
  33. -->
  34. <Head>
  35. <Title>Boost Graph Library: write_dimacs_max_flow</Title>
  36. <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
  37. ALINK="#ff0000">
  38. <IMG SRC="../../../boost.png"
  39. ALT="C++ Boost" width="277" height="86">
  40. <BR Clear>
  41. <H1><A NAME="sec:write_dimacs_max_flow">
  42. <TT>write_dimacs_max_flow</TT>
  43. </H1>
  44. <pre>
  45. //outputs a graph with including edge_capacity properties to an std::ostream
  46. template &lt; typename Graph, typename CapacityMap, typename IndexMap &gt;
  47. void write_dimacs_max_flow(Graph& g,
  48. CapacityMap capacity,
  49. IndexMap idx,
  50. typename graph_traits<Graph>::vertex_descriptor& src,
  51. typename graph_traits<Graph>::vertex_descriptor& sink,
  52. std::ostream& out)
  53. </pre>
  54. <p>
  55. This 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).
  56. The output can be read in again using the <a href="../../../boost/graph/read_dimacs.hpp"><TT>boost/graph/read_dimacs.hpp</TT></a> method.
  57. <H3>Where Defined</H3>
  58. <P>
  59. <a href="../../../boost/graph/write_dimacs.hpp"><TT>boost/graph/write_dimacs.hpp</TT></a>
  60. <h3>Parameters</h3>
  61. IN: <tt>Graph&amp; g</tt>
  62. <blockquote>
  63. A directed or undirected graph. The graph's type must be a model of
  64. <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>
  65. </blockquote>
  66. IN: <tt>CapacityMap capacity</tt>
  67. <blockquote>
  68. 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>
  69. </blockquote>
  70. IN: <tt>IndexMap epw</tt>
  71. <blockquote>
  72. 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>
  73. </blockquote>
  74. OUT: <tt>std::ostream&amp; out</tt>
  75. <blockquote>
  76. A standard <tt>std::ostream</tt> object.
  77. </blockquote>
  78. <H3>
  79. Example
  80. </H3>
  81. 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.
  82. <h3>See Also</h3>
  83. <a href="./read_dimacs.html"><tt>read_dimacs</tt></a>
  84. <h3>Notes</h3>
  85. <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.
  86. </BODY>
  87. </HTML>