mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-25 06:12:11 +08:00
Documentation for 3239fcc19e
This commit is contained in:
@@ -93,7 +93,6 @@ $(document).ready(function(){initNavTree('de/d00/classgraph_1_1is__graph__bipart
|
||||
<div class="summary">
|
||||
<a href="#pub-methods">Public Member Functions</a> |
|
||||
<a href="#pri-attribs">Private Attributes</a> |
|
||||
<a href="#pri-static-attribs">Static Private Attributes</a> |
|
||||
<a href="../../dc/d67/classgraph_1_1is__graph__bipartite_1_1_graph-members.html">List of all members</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">graph::is_graph_bipartite::Graph Class Reference</div> </div>
|
||||
@@ -111,10 +110,9 @@ Collaboration diagram for graph::is_graph_bipartite::Graph:</div>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
||||
Public Member Functions</h2></td></tr>
|
||||
<tr class="memitem:a477bf401cab737bb313f687b08fff082"><td class="memItemLeft" align="right" valign="top"><a id="a477bf401cab737bb313f687b08fff082"></a>
|
||||
 </td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a477bf401cab737bb313f687b08fff082">Graph</a> (int size=<a class="el" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a275227d01fbecdcf2f890b034fcea655">nax</a>)</td></tr>
|
||||
<tr class="memdesc:a477bf401cab737bb313f687b08fff082"><td class="mdescLeft"> </td><td class="mdescRight">Constructor that initializes the graph on creation. <br /></td></tr>
|
||||
<tr class="separator:a477bf401cab737bb313f687b08fff082"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a6aef65b40347c4606662cad4dd2e14d3"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a6aef65b40347c4606662cad4dd2e14d3">Graph</a> (int size)</td></tr>
|
||||
<tr class="memdesc:a6aef65b40347c4606662cad4dd2e14d3"><td class="mdescLeft"> </td><td class="mdescRight">Constructor that initializes the graph on creation. <a href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a6aef65b40347c4606662cad4dd2e14d3">More...</a><br /></td></tr>
|
||||
<tr class="separator:a6aef65b40347c4606662cad4dd2e14d3"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad8c10df34357b2cd865c81e0c4f0bd8c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ad8c10df34357b2cd865c81e0c4f0bd8c">addEdge</a> (int u, int v)</td></tr>
|
||||
<tr class="memdesc:ad8c10df34357b2cd865c81e0c4f0bd8c"><td class="mdescLeft"> </td><td class="mdescRight">Function that add an edge between two nodes or vertices of graph. <a href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ad8c10df34357b2cd865c81e0c4f0bd8c">More...</a><br /></td></tr>
|
||||
<tr class="separator:ad8c10df34357b2cd865c81e0c4f0bd8c"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -125,27 +123,61 @@ Public Member Functions</h2></td></tr>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-attribs"></a>
|
||||
Private Attributes</h2></td></tr>
|
||||
<tr class="memitem:aefea7ee87a708298c486d5a38ac628ef"><td class="memItemLeft" align="right" valign="top"><a id="aefea7ee87a708298c486d5a38ac628ef"></a>
|
||||
int </td><td class="memItemRight" valign="bottom"><b>n</b></td></tr>
|
||||
int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#aefea7ee87a708298c486d5a38ac628ef">n</a></td></tr>
|
||||
<tr class="memdesc:aefea7ee87a708298c486d5a38ac628ef"><td class="mdescLeft"> </td><td class="mdescRight">size of the graph <br /></td></tr>
|
||||
<tr class="separator:aefea7ee87a708298c486d5a38ac628ef"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a70dea3a7ae9738067e6b84abc192e429"><td class="memItemLeft" align="right" valign="top"><a id="a70dea3a7ae9738067e6b84abc192e429"></a>
|
||||
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int > > </td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a70dea3a7ae9738067e6b84abc192e429">adj</a></td></tr>
|
||||
<tr class="memdesc:a70dea3a7ae9738067e6b84abc192e429"><td class="mdescLeft"> </td><td class="mdescRight">size of the graph <br /></td></tr>
|
||||
<tr class="separator:a70dea3a7ae9738067e6b84abc192e429"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ab0efcfa04fff8616aff0062522d1483f"><td class="memItemLeft" align="right" valign="top"><a id="ab0efcfa04fff8616aff0062522d1483f"></a>
|
||||
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int > > </td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ab0efcfa04fff8616aff0062522d1483f">adj</a></td></tr>
|
||||
<tr class="memdesc:ab0efcfa04fff8616aff0062522d1483f"><td class="mdescLeft"> </td><td class="mdescRight">adj stores the graph as an adjacency list <br /></td></tr>
|
||||
<tr class="separator:ab0efcfa04fff8616aff0062522d1483f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a9d10768f927baa8a4d4a5ffce295b6b6"><td class="memItemLeft" align="right" valign="top"><a id="a9d10768f927baa8a4d4a5ffce295b6b6"></a>
|
||||
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int > </td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a></td></tr>
|
||||
<tr class="memdesc:a9d10768f927baa8a4d4a5ffce295b6b6"><td class="mdescLeft"> </td><td class="mdescRight">adj stores the graph as an adjacency list <br /></td></tr>
|
||||
<tr class="memdesc:a9d10768f927baa8a4d4a5ffce295b6b6"><td class="mdescLeft"> </td><td class="mdescRight">stores the side of the vertex <br /></td></tr>
|
||||
<tr class="separator:a9d10768f927baa8a4d4a5ffce295b6b6"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-static-attribs"></a>
|
||||
Static Private Attributes</h2></td></tr>
|
||||
<tr class="memitem:a275227d01fbecdcf2f890b034fcea655"><td class="memItemLeft" align="right" valign="top"><a id="a275227d01fbecdcf2f890b034fcea655"></a>
|
||||
static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a275227d01fbecdcf2f890b034fcea655">nax</a> = 5e5 + 1</td></tr>
|
||||
<tr class="memdesc:a275227d01fbecdcf2f890b034fcea655"><td class="mdescLeft"> </td><td class="mdescRight">stores the side of the vertex <br /></td></tr>
|
||||
<tr class="separator:a275227d01fbecdcf2f890b034fcea655"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Class for representing graph as an adjacency list. </p>
|
||||
</div><h2 class="groupheader">Member Function Documentation</h2>
|
||||
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
||||
<a id="a6aef65b40347c4606662cad4dd2e14d3"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a6aef65b40347c4606662cad4dd2e14d3">◆ </a></span>Graph()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">graph::is_graph_bipartite::Graph::Graph </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">int </td>
|
||||
<td class="paramname"><em>size</em></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Constructor that initializes the graph on creation. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">size</td><td>number of vertices of the graph </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  {</div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#aefea7ee87a708298c486d5a38ac628ef">n</a> = size;</div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ab0efcfa04fff8616aff0062522d1483f">adj</a>.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/resize.html">resize</a>(<a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#aefea7ee87a708298c486d5a38ac628ef">n</a>);</div>
|
||||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/resize.html">resize</a>(<a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#aefea7ee87a708298c486d5a38ac628ef">n</a>, -1);</div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  }</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="groupheader">Member Function Documentation</h2>
|
||||
<a id="ad8c10df34357b2cd865c81e0c4f0bd8c"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ad8c10df34357b2cd865c81e0c4f0bd8c">◆ </a></span>addEdge()</h2>
|
||||
|
||||
@@ -180,10 +212,10 @@ static const int </td><td class="memItemRight" valign="bottom"><a class="el
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  {</div>
|
||||
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a70dea3a7ae9738067e6b84abc192e429">adj</a>[u-1].<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(v-1);</div>
|
||||
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a70dea3a7ae9738067e6b84abc192e429">adj</a>[v-1].<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(u-1);</div>
|
||||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  }</div>
|
||||
<div class="fragment"><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  {</div>
|
||||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ab0efcfa04fff8616aff0062522d1483f">adj</a>[u - 1].<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(v - 1);</div>
|
||||
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ab0efcfa04fff8616aff0062522d1483f">adj</a>[v - 1].<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(u - 1);</div>
|
||||
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> }</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -210,32 +242,33 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>function to add edges to our graph </p>
|
||||
<p>function that checks whether the graph is bipartite or not the function returns true if the graph is a bipartite graph the function returns false if the graph is not a bipartite graph</p>
|
||||
<p>Here, side refers to the two disjoint subsets of the bipartite graph. Initially, the values of side are set to -1 which is an unassigned state. A for loop is run for every vertex of the graph. If the current edge has no side assigned to it, then a Breadth First Search operation is performed. If two neighbours have the same side then the graph will not be bipartite and the value of check becomes false. If and only if each pair of neighbours have different sides, the value of check will be true and hence the graph bipartite. </p>
|
||||
<div class="fragment"><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  {</div>
|
||||
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordtype">bool</span> check = <span class="keyword">true</span>;</div>
|
||||
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/queue.html">std::queue<int></a> q;</div>
|
||||
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> current_edge = 0; current_edge < n; ++current_edge)</div>
|
||||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  {</div>
|
||||
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">if</span>(<a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[current_edge] == -1){</div>
|
||||
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  q.push(current_edge);</div>
|
||||
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[current_edge] = 0;</div>
|
||||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">while</span>(q.size()){</div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordtype">int</span> current = q.front();</div>
|
||||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  q.pop();</div>
|
||||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordflow">for</span>(<span class="keyword">auto</span> neighbour : <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a70dea3a7ae9738067e6b84abc192e429">adj</a>[current]){</div>
|
||||
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordflow">if</span>(<a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[neighbour] == -1){</div>
|
||||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[neighbour] = (1 ^ <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[current]);</div>
|
||||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  q.push(neighbour);</div>
|
||||
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  }</div>
|
||||
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keywordflow">else</span>{</div>
|
||||
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  check &= (<a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[neighbour] != <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[current]);</div>
|
||||
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  }</div>
|
||||
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  }</div>
|
||||
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  }</div>
|
||||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  }</div>
|
||||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  }</div>
|
||||
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keywordflow">return</span> check;</div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  }</div>
|
||||
<p>Here, side refers to the two disjoint subsets of the bipartite graph. Initially, the values of side are set to -1 which is an unassigned state. A for loop is run for every vertex of the graph. If the current edge has no side assigned to it, then a Breadth First Search operation is performed. If two neighbours have the same side then the graph will not be bipartite and the value of check becomes false. If and only if each pair of neighbours have different sides, the value of check will be true and hence the graph bipartite.</p>
|
||||
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if th graph is bipartite </dd>
|
||||
<dd>
|
||||
<code>false</code> otherwise </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  {</div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordtype">bool</span> check = <span class="keyword">true</span>;</div>
|
||||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/queue.html">std::queue<int></a> q;</div>
|
||||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> current_edge = 0; current_edge < <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#aefea7ee87a708298c486d5a38ac628ef">n</a>; ++current_edge) {</div>
|
||||
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordflow">if</span> (<a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[current_edge] == -1) {</div>
|
||||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  q.push(current_edge);</div>
|
||||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[current_edge] = 0;</div>
|
||||
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordflow">while</span> (q.size()) {</div>
|
||||
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keywordtype">int</span> current = q.front();</div>
|
||||
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  q.pop();</div>
|
||||
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">for</span> (<span class="keyword">auto</span> neighbour : <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ab0efcfa04fff8616aff0062522d1483f">adj</a>[current]) {</div>
|
||||
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordflow">if</span> (<a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[neighbour] == -1) {</div>
|
||||
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[neighbour] = (1 ^ <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[current]);</div>
|
||||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  q.push(neighbour);</div>
|
||||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  check &= (<a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[neighbour] != <a class="code" href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">side</a>[current]);</div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  }</div>
|
||||
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  }</div>
|
||||
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  }</div>
|
||||
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  }</div>
|
||||
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  }</div>
|
||||
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordflow">return</span> check;</div>
|
||||
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span> }</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -244,10 +277,12 @@ Here is the call graph for this function:</div>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<div class="ttc" id="aresize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/resize.html">std::vector::resize</a></div><div class="ttdeci">T resize(T... args)</div></div>
|
||||
<div class="ttc" id="aqueue_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/queue.html">std::queue</a></div><div class="ttdoc">STL class.</div></div>
|
||||
<div class="ttc" id="apush_back_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">std::vector::push_back</a></div><div class="ttdeci">T push_back(T... args)</div></div>
|
||||
<div class="ttc" id="aclassgraph_1_1is__graph__bipartite_1_1_graph_html_a70dea3a7ae9738067e6b84abc192e429"><div class="ttname"><a href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a70dea3a7ae9738067e6b84abc192e429">graph::is_graph_bipartite::Graph::adj</a></div><div class="ttdeci">std::vector< std::vector< int > > adj</div><div class="ttdoc">size of the graph</div><div class="ttdef"><b>Definition:</b> is_graph_bipartite.cpp:53</div></div>
|
||||
<div class="ttc" id="aclassgraph_1_1is__graph__bipartite_1_1_graph_html_a9d10768f927baa8a4d4a5ffce295b6b6"><div class="ttname"><a href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">graph::is_graph_bipartite::Graph::side</a></div><div class="ttdeci">std::vector< int > side</div><div class="ttdoc">adj stores the graph as an adjacency list</div><div class="ttdef"><b>Definition:</b> is_graph_bipartite.cpp:55</div></div>
|
||||
<div class="ttc" id="aclassgraph_1_1is__graph__bipartite_1_1_graph_html_ab0efcfa04fff8616aff0062522d1483f"><div class="ttname"><a href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ab0efcfa04fff8616aff0062522d1483f">graph::is_graph_bipartite::Graph::adj</a></div><div class="ttdeci">std::vector< std::vector< int > > adj</div><div class="ttdoc">adj stores the graph as an adjacency list</div><div class="ttdef"><b>Definition:</b> is_graph_bipartite.cpp:56</div></div>
|
||||
<div class="ttc" id="aclassgraph_1_1is__graph__bipartite_1_1_graph_html_a9d10768f927baa8a4d4a5ffce295b6b6"><div class="ttname"><a href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6">graph::is_graph_bipartite::Graph::side</a></div><div class="ttdeci">std::vector< int > side</div><div class="ttdoc">stores the side of the vertex</div><div class="ttdef"><b>Definition:</b> is_graph_bipartite.cpp:58</div></div>
|
||||
<div class="ttc" id="aclassgraph_1_1is__graph__bipartite_1_1_graph_html_aefea7ee87a708298c486d5a38ac628ef"><div class="ttname"><a href="../../de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#aefea7ee87a708298c486d5a38ac628ef">graph::is_graph_bipartite::Graph::n</a></div><div class="ttdeci">int n</div><div class="ttdoc">size of the graph</div><div class="ttdef"><b>Definition:</b> is_graph_bipartite.cpp:53</div></div>
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
var classgraph_1_1is__graph__bipartite_1_1_graph =
|
||||
[
|
||||
[ "Graph", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a477bf401cab737bb313f687b08fff082", null ],
|
||||
[ "Graph", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a6aef65b40347c4606662cad4dd2e14d3", null ],
|
||||
[ "addEdge", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ad8c10df34357b2cd865c81e0c4f0bd8c", null ],
|
||||
[ "is_bipartite", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9b0c6400693a5cfff971f768dd5ca5ca", null ],
|
||||
[ "adj", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a70dea3a7ae9738067e6b84abc192e429", null ],
|
||||
[ "adj", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#ab0efcfa04fff8616aff0062522d1483f", null ],
|
||||
[ "n", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#aefea7ee87a708298c486d5a38ac628ef", null ],
|
||||
[ "nax", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a275227d01fbecdcf2f890b034fcea655", null ],
|
||||
[ "side", "de/d00/classgraph_1_1is__graph__bipartite_1_1_graph.html#a9d10768f927baa8a4d4a5ffce295b6b6", null ]
|
||||
];
|
||||
Reference in New Issue
Block a user