mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-07-17 03:51:27 +08:00
Documentation for 2dadbf73f4
This commit is contained in:
@@ -3,16 +3,18 @@
|
||||
<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.9.8"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: CycleCheck Class Reference</title>
|
||||
<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="../../clipboard.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../resize.js"></script>
|
||||
<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>
|
||||
@@ -41,7 +43,7 @@ MathJax.Hub.Config({
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.8 -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -53,7 +55,7 @@ var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -71,7 +73,7 @@ $(function() {
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d3/dbb/class_cycle_check.html','../../'); initResizable(); });
|
||||
$(function(){initNavTree('d3/dbb/class_cycle_check.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
@@ -108,9 +110,9 @@ $(document).ready(function(){initNavTree('d3/dbb/class_cycle_check.html','../../
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
|
||||
Static Public Member Functions</h2></td></tr>
|
||||
<tr class="memitem:ad9a270ffba3a68539b92272c702e3474" id="r_ad9a270ffba3a68539b92272c702e3474"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/dbb/class_cycle_check.html#ad9a270ffba3a68539b92272c702e3474">isCyclicDFS</a> (<a class="el" href="../../da/d9a/class_graph.html">Graph</a> const &graph)</td></tr>
|
||||
<tr class="memitem:ad9a270ffba3a68539b92272c702e3474" id="r_ad9a270ffba3a68539b92272c702e3474"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#ad9a270ffba3a68539b92272c702e3474">isCyclicDFS</a> (<a class="el" href="../../da/d9a/class_graph.html">Graph</a> const &graph)</td></tr>
|
||||
<tr class="separator:ad9a270ffba3a68539b92272c702e3474"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a399292a33edf87499daa52b51315aca5" id="r_a399292a33edf87499daa52b51315aca5"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/dbb/class_cycle_check.html#a399292a33edf87499daa52b51315aca5">isCyclicBFS</a> (<a class="el" href="../../da/d9a/class_graph.html">Graph</a> const &graph)</td></tr>
|
||||
<tr class="memitem:a399292a33edf87499daa52b51315aca5" id="r_a399292a33edf87499daa52b51315aca5"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a399292a33edf87499daa52b51315aca5">isCyclicBFS</a> (<a class="el" href="../../da/d9a/class_graph.html">Graph</a> const &graph)</td></tr>
|
||||
<tr class="separator:a399292a33edf87499daa52b51315aca5"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-types" name="pri-types"></a>
|
||||
@@ -123,7 +125,7 @@ Private Types</h2></td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-static-methods" name="pri-static-methods"></a>
|
||||
Static Private Member Functions</h2></td></tr>
|
||||
<tr class="memitem:a2f4485c08b45e7a21a2e86f9c3f01d8b" id="r_a2f4485c08b45e7a21a2e86f9c3f01d8b"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/dbb/class_cycle_check.html#a2f4485c08b45e7a21a2e86f9c3f01d8b">isCyclicDFSHelper</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map.html">AdjList</a> const &adjList, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< nodeStates > *state, unsigned int <a class="el" href="../../d5/da1/structnode.html">node</a>)</td></tr>
|
||||
<tr class="memitem:a2f4485c08b45e7a21a2e86f9c3f01d8b" id="r_a2f4485c08b45e7a21a2e86f9c3f01d8b"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a2f4485c08b45e7a21a2e86f9c3f01d8b">isCyclicDFSHelper</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map.html">AdjList</a> const &adjList, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< nodeStates > *state, unsigned int <a class="el" href="../../d5/da1/structnode.html">node</a>)</td></tr>
|
||||
<tr class="separator:a2f4485c08b45e7a21a2e86f9c3f01d8b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
@@ -170,8 +172,7 @@ Static Private Member Functions</h2></td></tr>
|
||||
<tr>
|
||||
<td class="memname">static bool CycleCheck::isCyclicBFS </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="../../da/d9a/class_graph.html">Graph</a> const & </td>
|
||||
<td class="paramname"><em>graph</em></td><td>)</td>
|
||||
<td class="paramtype"><a class="el" href="../../da/d9a/class_graph.html">Graph</a> const &</td> <td class="paramname"><span class="paramname"><em>graph</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -269,8 +270,7 @@ Here is the call graph for this function:</div>
|
||||
<tr>
|
||||
<td class="memname">static bool CycleCheck::isCyclicDFS </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="../../da/d9a/class_graph.html">Graph</a> const & </td>
|
||||
<td class="paramname"><em>graph</em></td><td>)</td>
|
||||
<td class="paramtype"><a class="el" href="../../da/d9a/class_graph.html">Graph</a> const &</td> <td class="paramname"><span class="paramname"><em>graph</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -311,7 +311,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 228</span> <span class="comment">// node as it has already been checked for presence of cycle.</span></div>
|
||||
<div class="line"><span class="lineno"> 229</span> <span class="keywordflow">if</span> (state[<a class="code hl_class" href="../../d5/da1/structnode.html">node</a>] == not_visited) {</div>
|
||||
<div class="line"><span class="lineno"> 230</span> <span class="comment">// Check for cycle.</span></div>
|
||||
<div class="line"><span class="lineno"> 231</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="../../d3/dbb/class_cycle_check.html#a2f4485c08b45e7a21a2e86f9c3f01d8b">isCyclicDFSHelper</a>(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.getAdjList(), &state, <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>)) {</div>
|
||||
<div class="line"><span class="lineno"> 231</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="#a2f4485c08b45e7a21a2e86f9c3f01d8b">isCyclicDFSHelper</a>(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.getAdjList(), &state, <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>)) {</div>
|
||||
<div class="line"><span class="lineno"> 232</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
||||
<div class="line"><span class="lineno"> 233</span> }</div>
|
||||
<div class="line"><span class="lineno"> 234</span> }</div>
|
||||
@@ -321,7 +321,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 238</span> <span class="comment">// the graph. Return false.</span></div>
|
||||
<div class="line"><span class="lineno"> 239</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><span class="lineno"> 240</span> }</div>
|
||||
<div class="ttc" id="aclass_cycle_check_html_a2f4485c08b45e7a21a2e86f9c3f01d8b"><div class="ttname"><a href="../../d3/dbb/class_cycle_check.html#a2f4485c08b45e7a21a2e86f9c3f01d8b">CycleCheck::isCyclicDFSHelper</a></div><div class="ttdeci">static bool isCyclicDFSHelper(AdjList const &adjList, std::vector< nodeStates > *state, unsigned int node)</div><div class="ttdef"><b>Definition</b> cycle_check_directed_graph.cpp:170</div></div>
|
||||
<div class="ttc" id="aclass_cycle_check_html_a2f4485c08b45e7a21a2e86f9c3f01d8b"><div class="ttname"><a href="#a2f4485c08b45e7a21a2e86f9c3f01d8b">CycleCheck::isCyclicDFSHelper</a></div><div class="ttdeci">static bool isCyclicDFSHelper(AdjList const &adjList, std::vector< nodeStates > *state, unsigned int node)</div><div class="ttdef"><b>Definition</b> cycle_check_directed_graph.cpp:170</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -342,25 +342,17 @@ Here is the call graph for this function:</div>
|
||||
<tr>
|
||||
<td class="memname">static bool CycleCheck::isCyclicDFSHelper </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map.html">AdjList</a> const & </td>
|
||||
<td class="paramname"><em>adjList</em>, </td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map.html">AdjList</a> const &</td> <td class="paramname"><span class="paramname"><em>adjList</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< nodeStates > * </td>
|
||||
<td class="paramname"><em>state</em>, </td>
|
||||
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< nodeStates > *</td> <td class="paramname"><span class="paramname"><em>state</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">unsigned int </td>
|
||||
<td class="paramname"><em>node</em> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>)</td>
|
||||
<td></td><td></td>
|
||||
<td class="paramtype">unsigned int</td> <td class="paramname"><span class="paramname"><em>node</em></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
@@ -381,7 +373,7 @@ Here is the call graph for this function:</div>
|
||||
<dl class="section return"><dt>Returns</dt><dd>true if graph has a cycle, else false. </dd></dl>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 172</span> {</div>
|
||||
<div class="line"><span class="lineno"> 173</span> <span class="comment">// Add node "in_stack" state.</span></div>
|
||||
<div class="line"><span class="lineno"> 174</span> (*state)[<a class="code hl_class" href="../../d5/da1/structnode.html">node</a>] = in_stack;</div>
|
||||
<div class="line"><span class="lineno"> 174</span> (*state)[<a class="code hl_typedef" href="../../d8/dee/avltree_8cpp.html#a74f0cf18a0e5b832d9994e2f2d022287">node</a>] = in_stack;</div>
|
||||
<div class="line"><span class="lineno"> 175</span> </div>
|
||||
<div class="line"><span class="lineno"> 176</span> <span class="comment">// If the node has children, then recursively visit all children of the</span></div>
|
||||
<div class="line"><span class="lineno"> 177</span> <span class="comment">// node.</span></div>
|
||||
@@ -392,7 +384,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 182</span> <span class="comment">// for presence of cycle.</span></div>
|
||||
<div class="line"><span class="lineno"> 183</span> <span class="keyword">auto</span> state_of_child = (*state)[child];</div>
|
||||
<div class="line"><span class="lineno"> 184</span> <span class="keywordflow">if</span> (state_of_child == not_visited) {</div>
|
||||
<div class="line"><span class="lineno"> 185</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="../../d3/dbb/class_cycle_check.html#a2f4485c08b45e7a21a2e86f9c3f01d8b">isCyclicDFSHelper</a>(adjList, state, child)) {</div>
|
||||
<div class="line"><span class="lineno"> 185</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="#a2f4485c08b45e7a21a2e86f9c3f01d8b">isCyclicDFSHelper</a>(adjList, state, child)) {</div>
|
||||
<div class="line"><span class="lineno"> 186</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
||||
<div class="line"><span class="lineno"> 187</span> }</div>
|
||||
<div class="line"><span class="lineno"> 188</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (state_of_child == in_stack) {</div>
|
||||
@@ -406,10 +398,11 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 196</span> </div>
|
||||
<div class="line"><span class="lineno"> 197</span> <span class="comment">// Current node has been evaluated for the presence of cycle and had no</span></div>
|
||||
<div class="line"><span class="lineno"> 198</span> <span class="comment">// cycle. Mark current node as "visited".</span></div>
|
||||
<div class="line"><span class="lineno"> 199</span> (*state)[<a class="code hl_class" href="../../d5/da1/structnode.html">node</a>] = visited;</div>
|
||||
<div class="line"><span class="lineno"> 199</span> (*state)[<a class="code hl_typedef" href="../../d8/dee/avltree_8cpp.html#a74f0cf18a0e5b832d9994e2f2d022287">node</a>] = visited;</div>
|
||||
<div class="line"><span class="lineno"> 200</span> <span class="comment">// Return that current node didn't result in any cycles.</span></div>
|
||||
<div class="line"><span class="lineno"> 201</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><span class="lineno"> 202</span> }</div>
|
||||
<div class="ttc" id="aavltree_8cpp_html_a74f0cf18a0e5b832d9994e2f2d022287"><div class="ttname"><a href="../../d8/dee/avltree_8cpp.html#a74f0cf18a0e5b832d9994e2f2d022287">node</a></div><div class="ttdeci">struct node { int data; int height; struct node *left; struct node *right;} node</div><div class="ttdoc">for std::queue</div><div class="ttdef"><b>Definition</b> avltree.cpp:13</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -427,7 +420,7 @@ Here is the call graph for this function:</div>
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../d3/dbb/class_cycle_check.html">CycleCheck</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.9.8 </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.10.0 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user