mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-28 20:43:50 +08:00
Documentation for 6365881e68
This commit is contained in:
186
df/ddd/connected__components_8cpp.html
Normal file
186
df/ddd/connected__components_8cpp.html
Normal file
@@ -0,0 +1,186 @@
|
||||
<!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">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.18"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: graph/connected_components.cpp File 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>
|
||||
<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>
|
||||
<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/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
<link href="../../doxygen.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 style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.18 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</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">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(document).ready(function(){initNavTree('df/ddd/connected__components_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<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">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#nested-classes">Classes</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">connected_components.cpp File Reference</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p><a href="https://en.wikipedia.org/wiki/Component_(graph_theory)">Graph Connected Components (Connected Components)</a>
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <algorithm></code><br />
|
||||
<code>#include <iostream></code><br />
|
||||
<code>#include <vector></code><br />
|
||||
</div><div class="textblock"><div class="dynheader">
|
||||
Include dependency graph for connected_components.cpp:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d77/connected__components_8cpp__incl.svg" width="264" height="112"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
|
||||
Classes</h2></td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d9b/classgraph.html">graph</a></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/ddd/connected__components_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
|
||||
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2"> </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/Component_(graph_theory)">Graph Connected Components (Connected Components)</a> </p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="http://github.com/ayaankhan98">Ayaan Khan</a></dd></dl>
|
||||
<p>A graph is a collection of nodes also called vertices and these vertices are connected by edges. A connected component in a graph refers to a set of vertices which are reachable form one another.</p>
|
||||
<pre>
|
||||
Example - Here is graph with 3 connected components</pre><pre> 3 9 6 8
|
||||
/ \ / / \ / \
|
||||
2---4 2 7 3 7</pre><pre> first second third
|
||||
component component component
|
||||
</pre> </div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="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="paramname"></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Main function </p>
|
||||
<p>creating a graph with 4 vertex</p>
|
||||
<p>Adding edges between vertices</p>
|
||||
<p>printing the connected components</p>
|
||||
<div class="fragment"><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  {<span class="comment"></span></div>
|
||||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="comment"> /// creating a graph with 4 vertex</span></div>
|
||||
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span> <span class="comment"></span> <a class="code" href="../../dd/d9b/classgraph.html">graph</a> g(4);</div>
|
||||
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span> <span class="comment"> /// Adding edges between vertices</span></div>
|
||||
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span> <span class="comment"></span> g.addEdge(1, 2);</div>
|
||||
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  g.addEdge(3, 2);</div>
|
||||
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> <span class="comment"> /// printing the connected components</span></div>
|
||||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> <span class="comment"></span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << g.getConnectedComponents();</div>
|
||||
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> }</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/ddd/connected__components_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="650" height="96"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<div class="ttc" id="aclassgraph_html"><div class="ttname"><a href="../../dd/d9b/classgraph.html">graph</a></div><div class="ttdef"><b>Definition:</b> bfs.cpp:3</div></div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<!-- start footer part -->
|
||||
<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="../../df/ddd/connected__components_8cpp.html">connected_components.cpp</a></li>
|
||||
<li class="footer">Generated on Thu Jun 25 2020 10:30:51 for Algorithms_in_C++ by
|
||||
<a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.18 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
5
df/ddd/connected__components_8cpp.js
Normal file
5
df/ddd/connected__components_8cpp.js
Normal file
@@ -0,0 +1,5 @@
|
||||
var connected__components_8cpp =
|
||||
[
|
||||
[ "graph", "dd/d9b/classgraph.html", "dd/d9b/classgraph" ],
|
||||
[ "main", "df/ddd/connected__components_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ]
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
<map id="main" name="main">
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,31,56,57"/>
|
||||
<area shape="rect" id="node2" href="$dd/d9b/classgraph.html#a35c12fba596d8bb48b1877b128c4ba6d" title="Function that add edge between two nodes or vertices of graph." alt="" coords="156,5,269,32"/>
|
||||
<area shape="rect" id="node3" href="$dd/d9b/classgraph.html#af9b34bbae0f618e2128c501b69339bb0" title="Function the calculates the connected compoents in the graph by performing the depth first search on ..." alt="" coords="104,56,321,83"/>
|
||||
<area shape="rect" id="node4" href="$dd/d9b/classgraph.html#a135921a59082b669678b029b301b8a1c" title="Function that perfoms depth first search algorithm on graph." alt="" coords="369,49,492,90"/>
|
||||
<area shape="rect" id="node5" href="$dd/d9b/classgraph.html#a6398e513b9574e029fbee07c6ac6e028" title="Utility function for depth first seach algorithm this function explores the vertex which is passed in..." alt="" coords="540,56,644,83"/>
|
||||
</map>
|
||||
@@ -0,0 +1 @@
|
||||
3e4afbc2b62e6fa42398564f941b787e
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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.0 (20200408.0750)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="487pt" height="72pt"
|
||||
viewBox="0.00 0.00 487.00 71.50" 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 67.5)">
|
||||
<title>main</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-67.5 483,-67.5 483,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title=" ">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="0,-25 0,-44 38,-44 38,-25 0,-25"/>
|
||||
<text text-anchor="middle" x="19" y="-32" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="node2" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_node2"><a xlink:href="../../dd/d9b/classgraph.html#a35c12fba596d8bb48b1877b128c4ba6d" target="_top" xlink:title="Function that add edge between two nodes or vertices of graph.">
|
||||
<polygon fill="white" stroke="black" points="113,-44 113,-63 198,-63 198,-44 113,-44"/>
|
||||
<text text-anchor="middle" x="155.5" y="-51" font-family="Helvetica,sans-Serif" font-size="10.00">graph::addEdge</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.14,-37.06C54.75,-39.41 80.16,-43 103,-46.23"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="102.54,-49.7 112.94,-47.63 103.52,-42.76 102.54,-49.7"/>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="node3" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_node3"><a xlink:href="../../dd/d9b/classgraph.html#af9b34bbae0f618e2128c501b69339bb0" target="_top" xlink:title="Function the calculates the connected compoents in the graph by performing the depth first search on ...">
|
||||
<polygon fill="white" stroke="black" points="74,-6 74,-25 237,-25 237,-6 74,-6"/>
|
||||
<text text-anchor="middle" x="155.5" y="-13" font-family="Helvetica,sans-Serif" font-size="10.00">graph::getConnectedComponents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.14,-31.94C48.57,-30.46 62.46,-28.5 77.01,-26.45"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="77.74,-29.88 87.15,-25.01 76.76,-22.95 77.74,-29.88"/>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="node4" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_node4"><a xlink:href="../../dd/d9b/classgraph.html#a135921a59082b669678b029b301b8a1c" target="_top" xlink:title="Function that perfoms depth first search algorithm on graph.">
|
||||
<polygon fill="white" stroke="black" points="273,-0.5 273,-30.5 365,-30.5 365,-0.5 273,-0.5"/>
|
||||
<text text-anchor="start" x="281" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">graph::depth_first</text>
|
||||
<text text-anchor="middle" x="319" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">_search</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node4 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>Node3->Node4</title>
|
||||
<path fill="none" stroke="midnightblue" d="M237.25,-15.5C245.79,-15.5 254.33,-15.5 262.48,-15.5"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="262.58,-19 272.58,-15.5 262.58,-12 262.58,-19"/>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="node5" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_node5"><a xlink:href="../../dd/d9b/classgraph.html#a6398e513b9574e029fbee07c6ac6e028" target="_top" xlink:title="Utility function for depth first seach algorithm this function explores the vertex which is passed in...">
|
||||
<polygon fill="white" stroke="black" points="401,-6 401,-25 479,-25 479,-6 401,-6"/>
|
||||
<text text-anchor="middle" x="440" y="-13" font-family="Helvetica,sans-Serif" font-size="10.00">graph::explore</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node5 -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>Node4->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M365.33,-15.5C373.64,-15.5 382.34,-15.5 390.74,-15.5"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="390.78,-19 400.78,-15.5 390.78,-12 390.78,-19"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.1 KiB |
Reference in New Issue
Block a user