a00086.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
  5. <title>GTL - Graph Template Library: maxflow_ff.h Source File</title>
  6. <link href="doxygen.css" rel="stylesheet" type="text/css">
  7. </head>
  8. <body>
  9. <p class="links">
  10. <a href="../index.html">Home</a> |
  11. Documentation |
  12. <a href="../register.html">Download</a> |
  13. <a href="../platforms.html">Platforms</a> |
  14. <a href="../refer.html">Projects</a> |
  15. <a href="../lists.html">Mailing Lists</a> |
  16. <a href="../history.html">Version History</a>
  17. </p>
  18. <!-- Generated by Doxygen 1.5.3 -->
  19. <div class="tabs">
  20. <ul>
  21. <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
  22. <li><a href="classes.html"><span>Classes</span></a></li>
  23. <li class="current"><a href="files.html"><span>Files</span></a></li>
  24. <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  25. </ul>
  26. </div>
  27. <h1>maxflow_ff.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//==========================================================================</span>
  28. <a name="l00002"></a>00002 <span class="comment">//</span>
  29. <a name="l00003"></a>00003 <span class="comment">// maxflow_ff.h</span>
  30. <a name="l00004"></a>00004 <span class="comment">//</span>
  31. <a name="l00005"></a>00005 <span class="comment">//==========================================================================</span>
  32. <a name="l00006"></a>00006 <span class="comment">// $Id: maxflow_ff.h,v 1.5 2003/01/31 08:15:05 chris Exp $</span>
  33. <a name="l00007"></a>00007
  34. <a name="l00008"></a>00008 <span class="preprocessor">#ifndef GTL_MAXFLOW_FF_H</span>
  35. <a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define GTL_MAXFLOW_FF_H</span>
  36. <a name="l00010"></a>00010 <span class="preprocessor"></span>
  37. <a name="l00011"></a>00011 <span class="preprocessor">#include &lt;GTL/GTL.h&gt;</span>
  38. <a name="l00012"></a>00012 <span class="preprocessor">#include &lt;GTL/graph.h&gt;</span>
  39. <a name="l00013"></a>00013 <span class="preprocessor">#include &lt;GTL/node_map.h&gt;</span>
  40. <a name="l00014"></a>00014 <span class="preprocessor">#include &lt;GTL/edge_map.h&gt;</span>
  41. <a name="l00015"></a>00015 <span class="preprocessor">#include &lt;GTL/algorithm.h&gt;</span>
  42. <a name="l00016"></a>00016
  43. <a name="l00017"></a>00017 <span class="preprocessor">#include &lt;queue&gt;</span>
  44. <a name="l00018"></a>00018
  45. <a name="l00019"></a>00019 __GTL_BEGIN_NAMESPACE
  46. <a name="l00020"></a>00020
  47. <a name="l00024"></a><a class="code" href="a00015.html">00024</a> <span class="keyword">class </span>GTL_EXTERN <a class="code" href="a00015.html" title="Maximum flow algorithm (Edmonds-Karp).">maxflow_ff</a> : <span class="keyword">public</span> <a class="code" href="a00001.html" title="Abstract baseclass for all algoritm-classes.">algorithm</a>
  48. <a name="l00025"></a>00025 {
  49. <a name="l00026"></a>00026 <span class="keyword">public</span>:
  50. <a name="l00033"></a>00033 <a class="code" href="a00015.html" title="Maximum flow algorithm (Edmonds-Karp).">maxflow_ff</a>();
  51. <a name="l00034"></a>00034
  52. <a name="l00040"></a>00040 <span class="keyword">virtual</span> ~<a class="code" href="a00015.html" title="Maximum flow algorithm (Edmonds-Karp).">maxflow_ff</a>();
  53. <a name="l00041"></a>00041
  54. <a name="l00049"></a>00049 <span class="keywordtype">void</span> set_vars(<span class="keyword">const</span> <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a>&amp; edge_capacity);
  55. <a name="l00050"></a>00050
  56. <a name="l00058"></a>00058 <span class="keywordtype">void</span> set_vars(
  57. <a name="l00059"></a>00059 <span class="keyword">const</span> <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a>&amp; edge_capacity,
  58. <a name="l00060"></a>00060 <span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; net_source,
  59. <a name="l00061"></a>00061 <span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; net_target);
  60. <a name="l00062"></a>00062
  61. <a name="l00080"></a>00080 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00001.html#76361fb03ad1cf643affc51821e43bed" title="Checks whether all preconditions are satisfied.">check</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
  62. <a name="l00081"></a>00081
  63. <a name="l00090"></a>00090 <span class="keywordtype">int</span> <a class="code" href="a00001.html#734b189509a8d6b56b65f8ff772d43ca" title="Applies algorithm to graph g.">run</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
  64. <a name="l00091"></a>00091
  65. <a name="l00098"></a>00098 <span class="keywordtype">double</span> get_max_flow(<span class="keyword">const</span> <a class="code" href="a00010.html" title="An edge in a graph.">edge</a>&amp; e) <span class="keyword">const</span>;
  66. <a name="l00099"></a>00099
  67. <a name="l00105"></a>00105 <span class="keywordtype">double</span> get_max_flow() <span class="keyword">const</span>;
  68. <a name="l00106"></a>00106
  69. <a name="l00113"></a>00113 <span class="keywordtype">double</span> get_rem_cap(<span class="keyword">const</span> <a class="code" href="a00010.html" title="An edge in a graph.">edge</a>&amp; e) <span class="keyword">const</span>;
  70. <a name="l00114"></a>00114
  71. <a name="l00121"></a>00121 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00001.html#21aba63d066ae7897de6ca7d8425c408" title="Resets algorithm.">reset</a>();
  72. <a name="l00122"></a>00122 <span class="keyword">protected</span>:
  73. <a name="l00126"></a>00126 <span class="keyword">enum</span> {SP_FOUND = 2, NO_SP_FOUND = 3};
  74. <a name="l00127"></a>00127
  75. <a name="l00131"></a>00131 <span class="keywordtype">bool</span> artif_source_target;
  76. <a name="l00132"></a>00132
  77. <a name="l00136"></a>00136 <span class="keywordtype">bool</span> set_vars_executed;
  78. <a name="l00137"></a>00137
  79. <a name="l00141"></a>00141 <span class="keywordtype">double</span> max_graph_flow;
  80. <a name="l00142"></a>00142
  81. <a name="l00146"></a>00146 <a class="code" href="a00020.html" title="A node in a graph.">node</a> net_source;
  82. <a name="l00147"></a>00147
  83. <a name="l00151"></a>00151 <a class="code" href="a00020.html" title="A node in a graph.">node</a> net_target;
  84. <a name="l00152"></a>00152
  85. <a name="l00156"></a>00156 list&lt;edge&gt; edges_not_org;
  86. <a name="l00157"></a>00157
  87. <a name="l00161"></a>00161 <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;bool&gt;</a> edge_org;
  88. <a name="l00162"></a>00162
  89. <a name="l00166"></a>00166 <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;bool&gt;</a> back_edge_exists;
  90. <a name="l00167"></a>00167
  91. <a name="l00171"></a>00171 <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;edge&gt;</a> back_edge;
  92. <a name="l00172"></a>00172
  93. <a name="l00176"></a>00176 <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a> edge_capacity;
  94. <a name="l00177"></a>00177
  95. <a name="l00181"></a>00181 <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a> edge_max_flow;
  96. <a name="l00182"></a>00182
  97. <a name="l00186"></a>00186 <span class="keywordtype">void</span> create_artif_source_target(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
  98. <a name="l00187"></a>00187
  99. <a name="l00191"></a>00191 <span class="keywordtype">void</span> prepare_run(<span class="keyword">const</span> <a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
  100. <a name="l00192"></a>00192
  101. <a name="l00196"></a>00196 <span class="keywordtype">void</span> comp_single_flow(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G, <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a>&amp; last_edge);
  102. <a name="l00197"></a>00197
  103. <a name="l00201"></a>00201 <span class="keywordtype">int</span> get_sp(<span class="keyword">const</span> <a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G, <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a>&amp; last_edge);
  104. <a name="l00202"></a>00202
  105. <a name="l00206"></a>00206 <span class="keywordtype">int</span> comp_sp(
  106. <a name="l00207"></a>00207 <span class="keyword">const</span> <a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G,
  107. <a name="l00208"></a>00208 queue&lt;node&gt;&amp; next_nodes,
  108. <a name="l00209"></a>00209 <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;bool&gt;</a>&amp; visited,
  109. <a name="l00210"></a>00210 <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a>&amp; last_edge);
  110. <a name="l00211"></a>00211
  111. <a name="l00215"></a>00215 <span class="keywordtype">double</span> extra_charge(<span class="keyword">const</span> <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a>&amp; last_edge) <span class="keyword">const</span>;
  112. <a name="l00216"></a>00216
  113. <a name="l00220"></a>00220 <span class="keywordtype">void</span> create_back_edge(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G, <span class="keyword">const</span> <a class="code" href="a00010.html" title="An edge in a graph.">edge</a>&amp; org_edge);
  114. <a name="l00221"></a>00221
  115. <a name="l00225"></a>00225 <span class="keywordtype">void</span> comp_max_flow(<span class="keyword">const</span> <a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
  116. <a name="l00226"></a>00226
  117. <a name="l00230"></a>00230 <span class="keywordtype">void</span> restore_graph(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
  118. <a name="l00231"></a>00231 };
  119. <a name="l00232"></a>00232
  120. <a name="l00233"></a>00233 __GTL_END_NAMESPACE
  121. <a name="l00234"></a>00234
  122. <a name="l00235"></a>00235 <span class="preprocessor">#endif // GTL_MAXFLOW_FF_H</span>
  123. <a name="l00236"></a>00236 <span class="preprocessor"></span>
  124. <a name="l00237"></a>00237 <span class="comment">//--------------------------------------------------------------------------</span>
  125. <a name="l00238"></a>00238 <span class="comment">// end of file</span>
  126. <a name="l00239"></a>00239 <span class="comment">//--------------------------------------------------------------------------</span>
  127. </pre></div> <p class="links">
  128. <a href="http://www.uni-passau.de/">University of Passau</a>
  129. &nbsp;-&nbsp;
  130. <a href="http://www.fmi.uni-passau.de/">FMI</a>
  131. &nbsp;-&nbsp;
  132. <a href="http://www.fmi.uni-passau.de/fmi/lehrstuehle/brandenburg/">Theoretical
  133. Computer Science</a>
  134. </p>
  135. <div class="copyright">
  136. Design &copy; 2002, 2003 <a href="mailto:raitner@fmi.uni-passau.de">Marcus Raitner</a>, University of Passau
  137. </div>
  138. </body>
  139. </html>