mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-22 12:52:48 +08:00
309 lines
22 KiB
HTML
309 lines
22 KiB
HTML
<!-- HTML header for doxygen 1.12.0-->
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||
<meta name="generator" content="Doxygen 1.14.0"/>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||
<title>TheAlgorithms/C++: graph/hopcroft_karp.cpp File Reference</title>
|
||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||
<script type="text/javascript" src="../../jquery.js"></script>
|
||
<script type="text/javascript" src="../../dynsections.js"></script>
|
||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
|
||
<script type="text/javascript">
|
||
DoxygenAwesomeDarkModeToggle.init()
|
||
</script>
|
||
<script type="text/javascript" src="../../clipboard.js"></script>
|
||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||
<script type="text/javascript" src="../../navtree.js"></script>
|
||
<script type="text/javascript" src="../../cookie.js"></script>
|
||
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
|
||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||
<script type="text/javascript" src="../../search/search.js"></script>
|
||
<script type="text/javascript">
|
||
window.MathJax = {
|
||
options: {
|
||
ignoreHtmlClass: 'tex2jax_ignore',
|
||
processHtmlClass: 'tex2jax_process'
|
||
},
|
||
loader: {
|
||
load: ['[tex]/ams']
|
||
},
|
||
tex: {
|
||
macros: {},
|
||
packages: ['base','configmacros','ams']
|
||
}
|
||
};
|
||
</script>
|
||
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
|
||
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
||
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
|
||
</head>
|
||
<body>
|
||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||
<div id="titlearea">
|
||
<table cellspacing="0" cellpadding="0">
|
||
<tbody>
|
||
<tr id="projectrow">
|
||
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
|
||
<td id="projectalign">
|
||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 1.0.0</span>
|
||
</div>
|
||
<div id="projectbrief">All the algorithms implemented in C++</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<!-- end header part -->
|
||
<!-- Generated by Doxygen 1.14.0 -->
|
||
<script type="text/javascript">
|
||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||
</script>
|
||
<script type="text/javascript">
|
||
$(function() { codefold.init(); });
|
||
</script>
|
||
<script type="text/javascript" src="../../menudata.js"></script>
|
||
<script type="text/javascript" src="../../menu.js"></script>
|
||
<script type="text/javascript">
|
||
$(function() {
|
||
initMenu('../../',true,false,'search.php','Search',true);
|
||
$(function() { init_search(); });
|
||
});
|
||
</script>
|
||
<div id="main-nav"></div>
|
||
</div><!-- top -->
|
||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||
<div id="nav-tree">
|
||
<div id="nav-tree-contents">
|
||
<div id="nav-sync" class="sync"></div>
|
||
</div>
|
||
</div>
|
||
<div id="splitbar" style="-moz-user-select:none;"
|
||
class="ui-resizable-handle">
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript">
|
||
$(function(){initNavTree('d1/d9a/hopcroft__karp_8cpp.html','../../',''); });
|
||
</script>
|
||
<div id="container">
|
||
<div id="doc-content">
|
||
<!-- window showing the filter options -->
|
||
<div id="MSearchSelectWindow"
|
||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||
</div>
|
||
|
||
<!-- iframe showing the search results (closed by default) -->
|
||
<div id="MSearchResultsWindow">
|
||
<div id="MSearchResults">
|
||
<div class="SRPage">
|
||
<div id="SRIndex">
|
||
<div id="SRResults"></div>
|
||
<div class="SRStatus" id="Loading">Loading...</div>
|
||
<div class="SRStatus" id="Searching">Searching...</div>
|
||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="header">
|
||
<div class="headertitle"><div class="title">hopcroft_karp.cpp File Reference</div></div>
|
||
</div><!--header-->
|
||
<div class="contents">
|
||
|
||
<p>Implementation of <a href="https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm" target="_blank">Hopcroft–Karp</a> algorithm.
|
||
<a href="#details">More...</a></p>
|
||
<div class="textblock"><code>#include <iostream></code><br />
|
||
<code>#include <cstdlib></code><br />
|
||
<code>#include <queue></code><br />
|
||
<code>#include <list></code><br />
|
||
<code>#include <climits></code><br />
|
||
<code>#include <memory></code><br />
|
||
<code>#include <cassert></code><br />
|
||
</div><div class="textblock"><div class="dynheader">
|
||
Include dependency graph for hopcroft_karp.cpp:</div>
|
||
<div class="dyncontent">
|
||
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="../../d9/d43/hopcroft__karp_8cpp__incl.svg" width="574" height="111"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||
</div>
|
||
</div>
|
||
<p><a href="../../d1/d9a/hopcroft__karp_8cpp_source.html">Go to the source code of this file.</a></p>
|
||
<table class="memberdecls">
|
||
<tr class="heading"><td colspan="2"><h2 id="header-nested-classes" class="groupheader"><a id="nested-classes" name="nested-classes"></a>
|
||
Classes</h2></td></tr>
|
||
<tr class="memitem:graph_3A_3AHKGraph" id="r_graph_3A_3AHKGraph"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d8/d69/classgraph_1_1_h_k_graph.html">graph::HKGraph</a></td></tr>
|
||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Represents Bipartite graph for Hopcroft Karp implementation. <a href="../../d8/d69/classgraph_1_1_h_k_graph.html#details">More...</a><br /></td></tr>
|
||
<tr class="memitem:HKGraph" id="r_HKGraph"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dee/class_h_k_graph.html">HKGraph</a></td></tr>
|
||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Represents Bipartite graph for Hopcroft Karp implementation. <a href="../../df/dee/class_h_k_graph.html#details">More...</a><br /></td></tr>
|
||
</table><table class="memberdecls">
|
||
<tr class="heading"><td colspan="2"><h2 id="header-namespaces" class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||
Namespaces</h2></td></tr>
|
||
<tr class="memitem:graph" id="r_graph"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dce/namespacegraph.html">graph</a></td></tr>
|
||
<tr class="memdesc:df/dce/namespacegraph"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="../../dc/d61/classgraph_1_1_graph.html">Graph</a> Algorithms. <br /></td></tr>
|
||
</table><table class="memberdecls">
|
||
<tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a>
|
||
Functions</h2></td></tr>
|
||
<tr class="memitem:a88ec9ad42717780d6caaff9d3d6977f9" id="r_a88ec9ad42717780d6caaff9d3d6977f9"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a88ec9ad42717780d6caaff9d3d6977f9">tests</a> ()</td></tr>
|
||
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4" id="r_ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
|
||
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft"> </td><td class="mdescRight">Main function. <br /></td></tr>
|
||
</table>
|
||
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
|
||
<div class="textblock"><p>Implementation of <a href="https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm" target="_blank">Hopcroft–Karp</a> algorithm. </p>
|
||
<p>The Hopcroft–Karp algorithm is an algorithm that takes as input a bipartite graph and produces as output a maximum cardinality matching, it runs in O(E√V) time in worst case.</p>
|
||
<h3 class="doxsection"><a class="anchor" id="autotoc_md77"></a>
|
||
Bipartite graph</h3>
|
||
<p>A bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint and independent sets U and V such that every edge connects a vertex in U to one in V. Vertex sets U and V are usually called the parts of the graph. Equivalently, a bipartite graph is a graph that does not contain any odd-length cycles.</p>
|
||
<h3 class="doxsection"><a class="anchor" id="autotoc_md78"></a>
|
||
Matching and Not-Matching edges</h3>
|
||
<p>Given a matching M, edges that are part of matching are called Matching edges and edges that are not part of M (or connect free nodes) are called Not-Matching edges.</p>
|
||
<h3 class="doxsection"><a class="anchor" id="autotoc_md79"></a>
|
||
Maximum cardinality matching</h3>
|
||
<p>Given a bipartite graphs G = ( V = ( X , Y ) , E ) whose partition has the parts X and Y, with E denoting the edges of the graph, the goal is to find a matching with as many edges as possible. Equivalently, a matching that covers as many vertices as possible.</p>
|
||
<h3 class="doxsection"><a class="anchor" id="autotoc_md80"></a>
|
||
Augmenting paths</h3>
|
||
<p>Given a matching M, an augmenting path is an alternating path that starts from and ends on free vertices. All single edge paths that start and end with free vertices are augmenting paths.</p>
|
||
<h3 class="doxsection"><a class="anchor" id="autotoc_md81"></a>
|
||
Concept</h3>
|
||
<p>A matching M is not maximum if there exists an augmenting path. It is also true other way, i.e, a matching is maximum if no augmenting path exists.</p>
|
||
<h3 class="doxsection"><a class="anchor" id="autotoc_md82"></a>
|
||
Algorithm</h3>
|
||
<p>1) Initialize the Maximal Matching M as empty. 2) While there exists an Augmenting Path P Remove matching edges of P from M and add not-matching edges of P to M (This increases size of M by 1 as P starts and ends with a free vertex i.e. a node that is not part of matching.) 3) Return M.</p>
|
||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/Krishnapal4050" target="_blank">Krishna Pal Deora</a> </dd></dl>
|
||
|
||
<p class="definition">Definition in file <a class="el" href="../../d1/d9a/hopcroft__karp_8cpp_source.html">hopcroft_karp.cpp</a>.</p>
|
||
</div><a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Function Documentation</h2>
|
||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||
|
||
<div class="memitem">
|
||
<div class="memproto">
|
||
<table class="memname">
|
||
<tr>
|
||
<td class="memname">int main </td>
|
||
<td>(</td>
|
||
<td class="paramtype">void</td> <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
<td></td>
|
||
</tr>
|
||
</table>
|
||
</div><div class="memdoc">
|
||
|
||
<p>Main function. </p>
|
||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||
|
||
<p class="definition">Definition at line <a class="el" href="../../d1/d9a/hopcroft__karp_8cpp_source.html#l00306">306</a> of file <a class="el" href="../../d1/d9a/hopcroft__karp_8cpp_source.html">hopcroft_karp.cpp</a>.</p>
|
||
<div class="fragment"><div class="line"><span class="lineno"> 307</span>{</div>
|
||
<div class="line"><span class="lineno"> 308</span> <a class="code hl_function" href="#a88ec9ad42717780d6caaff9d3d6977f9">tests</a>(); <span class="comment">// perform self-tests</span></div>
|
||
<div class="line"><span class="lineno"> 309</span> </div>
|
||
<div class="line"><span class="lineno"> 310</span> <span class="keywordtype">int</span> v1 = 0, v2 = 0, e = 0;</div>
|
||
<div class="line"><span class="lineno"> 311</span> std::cin >> v1 >> v2 >> e; <span class="comment">// vertices of left side, right side and edges</span></div>
|
||
<div class="line"><span class="lineno"> 312</span> <a class="code hl_class" href="../../d8/d69/classgraph_1_1_h_k_graph.html">HKGraph</a> <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a2f67508d5f392b0321772169342c98ad">g</a>(v1, v2); </div>
|
||
<div class="line"><span class="lineno"> 313</span> <span class="keywordtype">int</span> u = 0, v = 0;</div>
|
||
<div class="line"><span class="lineno"> 314</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < e; ++i)</div>
|
||
<div class="line"><span class="lineno"> 315</span> {</div>
|
||
<div class="line"><span class="lineno"> 316</span> std::cin >> u >> v;</div>
|
||
<div class="line"><span class="lineno"> 317</span> <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a2f67508d5f392b0321772169342c98ad">g</a>.addEdge(u, v);</div>
|
||
<div class="line"><span class="lineno"> 318</span> }</div>
|
||
<div class="line"><span class="lineno"> 319</span> </div>
|
||
<div class="line"><span class="lineno"> 320</span> <span class="keywordtype">int</span> res = <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a2f67508d5f392b0321772169342c98ad">g</a>.hopcroftKarpAlgorithm();</div>
|
||
<div class="line"><span class="lineno"> 321</span> std::cout << <span class="stringliteral">"Maximum matching is "</span> << res <<<span class="stringliteral">"\n"</span>;</div>
|
||
<div class="line"><span class="lineno"> 322</span> </div>
|
||
<div class="line"><span class="lineno"> 323</span> <span class="keywordflow">return</span> 0;</div>
|
||
<div class="line"><span class="lineno"> 324</span> </div>
|
||
<div class="line"><span class="lineno"> 325</span>}</div>
|
||
<div class="ttc" id="aclassgraph_1_1_h_k_graph_html"><div class="ttname"><a href="../../d8/d69/classgraph_1_1_h_k_graph.html">graph::HKGraph</a></div><div class="ttdoc">Represents Bipartite graph for Hopcroft Karp implementation.</div><div class="ttdef"><b>Definition</b> <a href="../../d1/d9a/hopcroft__karp_8cpp_source.html#l00066">hopcroft_karp.cpp:67</a></div></div>
|
||
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a2f67508d5f392b0321772169342c98ad"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a2f67508d5f392b0321772169342c98ad">numerical_methods::simpson_method::g</a></div><div class="ttdeci">double g(double x)</div><div class="ttdoc">Another test function.</div><div class="ttdef"><b>Definition</b> <a href="../../d4/d18/composite__simpson__rule_8cpp_source.html#l00115">composite_simpson_rule.cpp:115</a></div></div>
|
||
<div class="ttc" id="ahopcroft__karp_8cpp_html_a88ec9ad42717780d6caaff9d3d6977f9"><div class="ttname"><a href="#a88ec9ad42717780d6caaff9d3d6977f9">tests</a></div><div class="ttdeci">void tests()</div><div class="ttdef"><b>Definition</b> <a href="../../d1/d9a/hopcroft__karp_8cpp_source.html#l00255">hopcroft_karp.cpp:255</a></div></div>
|
||
</div><!-- fragment -->
|
||
</div>
|
||
</div>
|
||
<a id="a88ec9ad42717780d6caaff9d3d6977f9" name="a88ec9ad42717780d6caaff9d3d6977f9"></a>
|
||
<h2 class="memtitle"><span class="permalink"><a href="#a88ec9ad42717780d6caaff9d3d6977f9">◆ </a></span>tests()</h2>
|
||
|
||
<div class="memitem">
|
||
<div class="memproto">
|
||
<table class="memname">
|
||
<tr>
|
||
<td class="memname">void tests </td>
|
||
<td>(</td>
|
||
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
|
||
<td></td>
|
||
</tr>
|
||
</table>
|
||
</div><div class="memdoc">
|
||
<p>Self-test implementation </p><dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
|
||
|
||
<p class="definition">Definition at line <a class="el" href="../../d1/d9a/hopcroft__karp_8cpp_source.html#l00255">255</a> of file <a class="el" href="../../d1/d9a/hopcroft__karp_8cpp_source.html">hopcroft_karp.cpp</a>.</p>
|
||
<div class="fragment"><div class="line"><span class="lineno"> 255</span> {</div>
|
||
<div class="line"><span class="lineno"> 256</span> <span class="comment">// Sample test case 1</span></div>
|
||
<div class="line"><span class="lineno"> 257</span> <span class="keywordtype">int</span> v1a = 3, v1b = 5; <span class="comment">// vertices of left side, right side and edges</span></div>
|
||
<div class="line"><span class="lineno"> 258</span> <a class="code hl_class" href="../../d8/d69/classgraph_1_1_h_k_graph.html">HKGraph</a> g1(v1a, v1b); <span class="comment">// execute the algorithm </span></div>
|
||
<div class="line"><span class="lineno"> 259</span> </div>
|
||
<div class="line"><span class="lineno"> 260</span> g1.addEdge(0,1);</div>
|
||
<div class="line"><span class="lineno"> 261</span> g1.addEdge(1,4);</div>
|
||
<div class="line"><span class="lineno"> 262</span> </div>
|
||
<div class="line"><span class="lineno"> 263</span> <span class="keywordtype">int</span> expected_res1 = 0; <span class="comment">// for the above sample data, this is the expected output</span></div>
|
||
<div class="line"><span class="lineno"> 264</span> <span class="keywordtype">int</span> res1 = g1.hopcroftKarpAlgorithm();</div>
|
||
<div class="line"><span class="lineno"> 265</span> </div>
|
||
<div class="line"><span class="lineno"> 266</span> assert(res1 == expected_res1); <span class="comment">// assert check to ensure that the algorithm executed correctly for test 1</span></div>
|
||
<div class="line"><span class="lineno"> 267</span> </div>
|
||
<div class="line"><span class="lineno"> 268</span> <span class="comment">// Sample test case 2</span></div>
|
||
<div class="line"><span class="lineno"> 269</span> <span class="keywordtype">int</span> v2a = 4, v2b = 4; <span class="comment">// vertices of left side, right side and edges</span></div>
|
||
<div class="line"><span class="lineno"> 270</span> <a class="code hl_class" href="../../d8/d69/classgraph_1_1_h_k_graph.html">HKGraph</a> g2(v2a, v2b); <span class="comment">// execute the algorithm </span></div>
|
||
<div class="line"><span class="lineno"> 271</span> </div>
|
||
<div class="line"><span class="lineno"> 272</span> g2.addEdge(1,1);</div>
|
||
<div class="line"><span class="lineno"> 273</span> g2.addEdge(1,3);</div>
|
||
<div class="line"><span class="lineno"> 274</span> g2.addEdge(2,3);</div>
|
||
<div class="line"><span class="lineno"> 275</span> g2.addEdge(3,4);</div>
|
||
<div class="line"><span class="lineno"> 276</span> g2.addEdge(4,3);</div>
|
||
<div class="line"><span class="lineno"> 277</span> g2.addEdge(4,2);</div>
|
||
<div class="line"><span class="lineno"> 278</span> </div>
|
||
<div class="line"><span class="lineno"> 279</span> <span class="keywordtype">int</span> expected_res2 = 0; <span class="comment">// for the above sample data, this is the expected output</span></div>
|
||
<div class="line"><span class="lineno"> 280</span> <span class="keywordtype">int</span> res2 = g2.hopcroftKarpAlgorithm();</div>
|
||
<div class="line"><span class="lineno"> 281</span> </div>
|
||
<div class="line"><span class="lineno"> 282</span> assert(res2 == expected_res2); <span class="comment">// assert check to ensure that the algorithm executed correctly for test 2</span></div>
|
||
<div class="line"><span class="lineno"> 283</span> </div>
|
||
<div class="line"><span class="lineno"> 284</span> <span class="comment">// Sample test case 3</span></div>
|
||
<div class="line"><span class="lineno"> 285</span> <span class="keywordtype">int</span> v3a = 6, v3b = 6; <span class="comment">// vertices of left side, right side and edges</span></div>
|
||
<div class="line"><span class="lineno"> 286</span> <a class="code hl_class" href="../../d8/d69/classgraph_1_1_h_k_graph.html">HKGraph</a> g3(v3a, v3b); <span class="comment">// execute the algorithm </span></div>
|
||
<div class="line"><span class="lineno"> 287</span> </div>
|
||
<div class="line"><span class="lineno"> 288</span> g3.addEdge(0,1);</div>
|
||
<div class="line"><span class="lineno"> 289</span> g3.addEdge(1,4);</div>
|
||
<div class="line"><span class="lineno"> 290</span> g3.addEdge(1,5);</div>
|
||
<div class="line"><span class="lineno"> 291</span> g3.addEdge(5,0);</div>
|
||
<div class="line"><span class="lineno"> 292</span> </div>
|
||
<div class="line"><span class="lineno"> 293</span> <span class="keywordtype">int</span> expected_res3 = 0; <span class="comment">// for the above sample data, this is the expected output</span></div>
|
||
<div class="line"><span class="lineno"> 294</span> <span class="keywordtype">int</span> res3 = g3.hopcroftKarpAlgorithm();</div>
|
||
<div class="line"><span class="lineno"> 295</span> </div>
|
||
<div class="line"><span class="lineno"> 296</span> assert(res3 == expected_res3); <span class="comment">// assert check to ensure that the algorithm executed correctly for test 3</span></div>
|
||
<div class="line"><span class="lineno"> 297</span> </div>
|
||
<div class="line"><span class="lineno"> 298</span> </div>
|
||
<div class="line"><span class="lineno"> 299</span> </div>
|
||
<div class="line"><span class="lineno"> 300</span>}</div>
|
||
</div><!-- fragment -->
|
||
</div>
|
||
</div>
|
||
</div><!-- contents -->
|
||
</div><!-- doc-content -->
|
||
<div id="page-nav" class="page-nav-panel">
|
||
<div id="page-nav-resize-handle"></div>
|
||
<div id="page-nav-tree">
|
||
<div id="page-nav-contents">
|
||
</div><!-- page-nav-contents -->
|
||
</div><!-- page-nav-tree -->
|
||
</div><!-- page-nav -->
|
||
</div><!-- container -->
|
||
<!-- start footer part -->
|
||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||
<ul>
|
||
<li class="navelem"><a href="../../dir_12552d7fa429bf94a2e32e5cf39f7e69.html">graph</a></li><li class="navelem"><a href="../../d1/d9a/hopcroft__karp_8cpp.html">hopcroft_karp.cpp</a></li>
|
||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0 </li>
|
||
</ul>
|
||
</div>
|
||
</body>
|
||
</html>
|