mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-31 01:02:46 +08:00
Documentation for b4b182a61d
This commit is contained in:
5
d1/d6d/queue__using__array_8cpp__incl.map
Normal file
5
d1/d6d/queue__using__array_8cpp__incl.map
Normal file
@@ -0,0 +1,5 @@
|
||||
<map id="data_structures/queue_using_array.cpp" name="data_structures/queue_using_array.cpp">
|
||||
<area shape="rect" id="node1" title="Implementation of Linear Queue using array." alt="" coords="9,5,159,47"/>
|
||||
<area shape="rect" id="node2" title=" " alt="" coords="5,95,77,121"/>
|
||||
<area shape="rect" id="node3" title=" " alt="" coords="101,95,152,121"/>
|
||||
</map>
|
||||
1
d1/d6d/queue__using__array_8cpp__incl.md5
Normal file
1
d1/d6d/queue__using__array_8cpp__incl.md5
Normal file
@@ -0,0 +1 @@
|
||||
531e2cf0e1ec125b5b629a3919e25196
|
||||
53
d1/d6d/queue__using__array_8cpp__incl.svg
Normal file
53
d1/d6d/queue__using__array_8cpp__incl.svg
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
|
||||
-->
|
||||
<!-- Title: data_structures/queue_using_array.cpp Pages: 1 -->
|
||||
<svg width="124pt" height="95pt"
|
||||
viewBox="0.00 0.00 123.50 95.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 91)">
|
||||
<title>data_structures/queue_using_array.cpp</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-91 119.5,-91 119.5,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title="Implementation of Linear Queue using array.">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="2.5,-56.5 2.5,-86.5 115.5,-86.5 115.5,-56.5 2.5,-56.5"/>
|
||||
<text text-anchor="start" x="10.5" y="-74.5" font-family="Helvetica,sans-Serif" font-size="10.00">data_structures/queue</text>
|
||||
<text text-anchor="middle" x="59" y="-63.5" font-family="Helvetica,sans-Serif" font-size="10.00">_using_array.cpp</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="node2" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_node2"><a xlink:title=" ">
|
||||
<polygon fill="white" stroke="#bfbfbf" points="0,-0.5 0,-19.5 54,-19.5 54,-0.5 0,-0.5"/>
|
||||
<text text-anchor="middle" x="27" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">iostream</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<path fill="none" stroke="midnightblue" d="M51.42,-56.4C46.96,-48.11 41.28,-37.55 36.52,-28.71"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="39.48,-26.81 31.66,-19.66 33.31,-30.12 39.48,-26.81"/>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="node3" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_node3"><a xlink:title=" ">
|
||||
<polygon fill="white" stroke="#bfbfbf" points="72,-0.5 72,-19.5 110,-19.5 110,-0.5 72,-0.5"/>
|
||||
<text text-anchor="middle" x="91" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">array</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<path fill="none" stroke="midnightblue" d="M66.58,-56.4C71.04,-48.11 76.72,-37.55 81.48,-28.71"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="84.69,-30.12 86.34,-19.66 78.52,-26.81 84.69,-30.12"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -138,22 +138,22 @@ Functions</h2></td></tr>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Implementation of <a href="https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm">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><a class="anchor" id="autotoc_md55"></a>
|
||||
<h3><a class="anchor" id="autotoc_md56"></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><a class="anchor" id="autotoc_md56"></a>
|
||||
<h3><a class="anchor" id="autotoc_md57"></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><a class="anchor" id="autotoc_md57"></a>
|
||||
<h3><a class="anchor" id="autotoc_md58"></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><a class="anchor" id="autotoc_md58"></a>
|
||||
<h3><a class="anchor" id="autotoc_md59"></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><a class="anchor" id="autotoc_md59"></a>
|
||||
<h3><a class="anchor" id="autotoc_md60"></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><a class="anchor" id="autotoc_md60"></a>
|
||||
<h3><a class="anchor" id="autotoc_md61"></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">Krishna Pal Deora</a> </dd></dl>
|
||||
|
||||
Reference in New Issue
Block a user