Documentation for 0931d530ae

This commit is contained in:
github-actions
2023-01-22 19:44:10 +00:00
parent a448f64699
commit b48f6e8671
2457 changed files with 9513 additions and 8691 deletions

View File

@@ -3,7 +3,7 @@
<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.5"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: graph/depth_first_search_with_stack.cpp File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -131,15 +131,15 @@ Namespaces</h2></td></tr>
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aadebe9c855821d6515ca5b171222ef7b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/d4b/depth__first__search__with__stack_8cpp.html#aadebe9c855821d6515ca5b171222ef7b">graph::depth_first_search::addEdge</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; size_t &gt; &gt; *adj, size_t u, size_t v)</td></tr>
<tr class="memdesc:aadebe9c855821d6515ca5b171222ef7b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds and edge between two vertices of graph say u and v in this case. <a href="../../da/d4b/depth__first__search__with__stack_8cpp.html#aadebe9c855821d6515ca5b171222ef7b">More...</a><br /></td></tr>
<tr class="memdesc:aadebe9c855821d6515ca5b171222ef7b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds and edge between two vertices of graph say u and v in this case. <br /></td></tr>
<tr class="separator:aadebe9c855821d6515ca5b171222ef7b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5738da9f508f6a9e87f123c9fb6f2ea9"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; size_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/d4b/depth__first__search__with__stack_8cpp.html#a5738da9f508f6a9e87f123c9fb6f2ea9">graph::depth_first_search::dfs</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; size_t &gt; &gt; &amp;graph, size_t start)</td></tr>
<tr class="memdesc:a5738da9f508f6a9e87f123c9fb6f2ea9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Explores the given vertex, exploring a vertex means traversing over all the vertices which are connected to the vertex that is currently being explored and push it onto the stack. <a href="../../da/d4b/depth__first__search__with__stack_8cpp.html#a5738da9f508f6a9e87f123c9fb6f2ea9">More...</a><br /></td></tr>
<tr class="memdesc:a5738da9f508f6a9e87f123c9fb6f2ea9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Explores the given vertex, exploring a vertex means traversing over all the vertices which are connected to the vertex that is currently being explored and push it onto the stack. <br /></td></tr>
<tr class="separator:a5738da9f508f6a9e87f123c9fb6f2ea9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a483bb8ccf42aaf7375a83e91490eda1e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/d4b/depth__first__search__with__stack_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e">tests</a> ()</td></tr>
<tr class="separator:a483bb8ccf42aaf7375a83e91490eda1e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/d4b/depth__first__search__with__stack_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <a href="../../da/d4b/depth__first__search__with__stack_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">More...</a><br /></td></tr>
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
@@ -160,12 +160,12 @@ constexpr int64_t&#160;</td><td class="memItemRight" valign="bottom"><b>INF</b>
<tr class="separator:a330a2b0a904f01802ada1f8f3b28e76c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p ><a href="https://en.wikipedia.org/wiki/Depth-first_search" target="_blank">Depth First Search Algorithm using Stack (Depth First Search Algorithm)</a> </p>
<div class="textblock"><p><a href="https://en.wikipedia.org/wiki/Depth-first_search" target="_blank">Depth First Search Algorithm using Stack (Depth First Search Algorithm)</a> </p>
<dl class="section author"><dt>Author</dt><dd><a href="http://github.com/ayaankhan98" target="_blank">Ayaan Khan</a> </dd>
<dd>
<a href="https://github.com/sauravUppoor" target="_blank">Saurav Uppoor</a></dd></dl>
<p>Depth First Search also quoted as DFS is a <a class="el" href="../../da/d9a/class_graph.html">Graph</a> Traversal Algorithm. Time Complexity O(|V| + |E|) where V is number of vertices and E is number of edges in graph.</p>
<p >Application of Depth First Search are</p>
<p>Application of Depth First Search are</p>
<ol type="1">
<li>Finding connected components</li>
<li>Finding 2-(edge or vertex)-connected components.</li>
@@ -272,11 +272,11 @@ constexpr int64_t&#160;</td><td class="memItemRight" valign="bottom"><b>INF</b>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vector with nodes stored in the order of DFS traversal </dd></dl>
<p >checked[i] stores the status of each node</p>
<p >while stack is not empty we keep exploring the node on top of stack</p>
<p >push the node to the final result vector</p>
<p >exploring the neighbours of the current node</p>
<p ><a class="el" href="../../db/d8b/struct_node.html">Node</a> has been explored</p>
<p>checked[i] stores the status of each node</p>
<p>while stack is not empty we keep exploring the node on top of stack</p>
<p>push the node to the final result vector</p>
<p>exploring the neighbours of the current node</p>
<p><a class="el" href="../../db/d8b/struct_node.html">Node</a> has been explored</p>
<div class="fragment"><div class="line"><span class="lineno"> 87</span> {<span class="comment"></span></div>
<div class="line"><span class="lineno"> 88</span><span class="comment"> /// checked[i] stores the status of each node</span></div>
<div class="line"><span class="lineno"> 89</span><span class="comment"></span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;size_t&gt;</a> checked(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.size(), <a class="code hl_variable" href="../../da/d4b/depth__first__search__with__stack_8cpp.html#afb80b42b42381658a12a57a975ecd0c7">WHITE</a>), traversed_path;</div>
@@ -344,10 +344,10 @@ Here is the call graph for this function:</div>
<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<p >creating a graph</p>
<p >taking input for the edges</p>
<p >taking input for the starting position</p>
<p >Printing the order of traversal</p>
<p>creating a graph</p>
<p>taking input for the edges</p>
<p>taking input for the starting position</p>
<p>Printing the order of traversal</p>
<div class="fragment"><div class="line"><span class="lineno"> 173</span> {</div>
<div class="line"><span class="lineno"> 174</span> <a class="code hl_function" href="../../da/d4b/depth__first__search__with__stack_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e">tests</a>(); <span class="comment">// execute the tests</span></div>
<div class="line"><span class="lineno"> 175</span> </div>
@@ -420,13 +420,13 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p >Self-test implementations </p><dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
<p >Test 1</p>
<p >for the above sample data, this is the expected output</p>
<p >Test 2</p>
<p >for the above sample data, this is the expected output</p>
<p >Test 3</p>
<p >for the above sample data, this is the expected output</p>
<p>Self-test implementations </p><dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
<p>Test 1</p>
<p>for the above sample data, this is the expected output</p>
<p>Test 2</p>
<p>for the above sample data, this is the expected output</p>
<p>Test 3</p>
<p>for the above sample data, this is the expected output</p>
<div class="fragment"><div class="line"><span class="lineno"> 123</span> {</div>
<div class="line"><span class="lineno"> 124</span> <span class="keywordtype">size_t</span> start_pos;</div>
<div class="line"><span class="lineno"> 125</span><span class="comment"></span> </div>
@@ -501,7 +501,7 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p >for IO operations header for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/stack.html">std::stack</a> header for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a> header for preprocessor macro assert() header for limits of integral types </p>
<p>for IO operations header for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/stack.html">std::stack</a> header for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a> header for preprocessor macro assert() header for limits of integral types </p>
</div>
</div>
@@ -511,7 +511,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="../../dir_12552d7fa429bf94a2e32e5cf39f7e69.html">graph</a></li><li class="navelem"><a class="el" href="../../da/d4b/depth__first__search__with__stack_8cpp.html">depth_first_search_with_stack.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.9.5 </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.6 </li>
</ul>
</div>
</body>