mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-07-17 12:02:22 +08:00
Documentation for 8b1eab204b
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<!-- HTML header for doxygen 1.12.0-->
|
||||
<!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" lang="en-US">
|
||||
<head>
|
||||
@@ -5,10 +6,15 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: data_structures/dsu_union_rank.cpp File Reference</title>
|
||||
<title>TheAlgorithms/C++: data_structures/dsu_union_rank.cpp File Reference</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
<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="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
|
||||
<script type="text/javascript">
|
||||
DoxygenAwesomeDarkModeToggle.init()
|
||||
</script>
|
||||
<script type="text/javascript" src="../../clipboard.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||||
@@ -18,14 +24,24 @@
|
||||
<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 type="text/javascript">
|
||||
window.MathJax = {
|
||||
options: {
|
||||
ignoreHtmlClass: 'tex2jax_ignore',
|
||||
processHtmlClass: 'tex2jax_process'
|
||||
},
|
||||
loader: {
|
||||
load: ['[tex]/ams']
|
||||
},
|
||||
tex: {
|
||||
macros: {},
|
||||
packages: ['base','configmacros','ams']
|
||||
}
|
||||
};
|
||||
</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>
|
||||
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
|
||||
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
<div id="projectbrief">All the algorithms implemented in C++</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -122,7 +139,9 @@ Include dependency graph for dsu_union_rank.cpp:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d7/dda/dsu__union__rank_8cpp__incl.svg" width="336" height="126"><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">
|
||||
</div>
|
||||
<p><a href="../../df/d28/dsu__union__rank_8cpp_source.html">Go to the source code of this file.</a></p>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" 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/d1f/classdsu.html">dsu</a></td></tr>
|
||||
@@ -146,6 +165,8 @@ Functions</h2></td></tr>
|
||||
<p>dsu : It is a very powerful data structure which keeps track of different clusters(sets) of elements, these sets are disjoint(doesnot have a common
|
||||
element). Disjoint sets uses cases : for finding connected components in a graph, used in Kruskal's algorithm for finding <a class="el" href="../../d4/d12/namespace_minimum.html" title="Implementation of Minimum Edit Distance algorithm.">Minimum</a> Spanning tree. Operations that can be performed: 1) UnionSet(i,j): add(element i and j to the set) 2) findSet(i): returns the representative of the set to which i belogngs to. 3) getParents(i): prints the parent of i and so on and so forth. Below is the class-based approach which uses the heuristic of union-ranks. Using union-rank in findSet(i),we are able to get to the representative of i in slightly delayed O(logN) time but it allows us to keep tracks of the parent of i. </p><dl class="section author"><dt>Author</dt><dd><a href="https://github.com/AayushVyasKIIT" target="_blank">AayushVyasKIIT</a> </dd></dl>
|
||||
<dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d3/dae/dsu__path__compression_8cpp.html" title="DSU (Disjoint sets)">dsu_path_compression.cpp</a> </dd></dl>
|
||||
|
||||
<p class="definition">Definition in file <a class="el" href="../../df/d28/dsu__union__rank_8cpp_source.html">dsu_union_rank.cpp</a>.</p>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
@@ -164,20 +185,17 @@ element). Disjoint sets uses cases : for finding connected components in a graph
|
||||
|
||||
<p>Main function. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../df/d28/dsu__union__rank_8cpp_source.html#l00183">183</a> of file <a class="el" href="../../df/d28/dsu__union__rank_8cpp_source.html">dsu_union_rank.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 183</span> {</div>
|
||||
<div class="line"><span class="lineno"> 184</span> <a class="code hl_function" href="#ae7880ce913f3058a35ff106d5be9e243">test1</a>(); <span class="comment">// run 1st test case</span></div>
|
||||
<div class="line"><span class="lineno"> 185</span> <a class="code hl_function" href="#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a>(); <span class="comment">// run 2nd test case</span></div>
|
||||
<div class="line"><span class="lineno"> 186</span> </div>
|
||||
<div class="line"><span class="lineno"> 187</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><span class="lineno"> 188</span>}</div>
|
||||
<div class="ttc" id="adsu__union__rank_8cpp_html_a45d94ead4cf4e1ff9f87c38bc99f59ae"><div class="ttname"><a href="#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a></div><div class="ttdeci">static void test2()</div><div class="ttdoc">Self-implementations, 2nd test.</div><div class="ttdef"><b>Definition</b> dsu_union_rank.cpp:158</div></div>
|
||||
<div class="ttc" id="adsu__union__rank_8cpp_html_ae7880ce913f3058a35ff106d5be9e243"><div class="ttname"><a href="#ae7880ce913f3058a35ff106d5be9e243">test1</a></div><div class="ttdeci">static void test1()</div><div class="ttdoc">Self-implementations, 1st test.</div><div class="ttdef"><b>Definition</b> dsu_union_rank.cpp:134</div></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/d28/dsu__union__rank_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="602" height="138"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<div class="ttc" id="adsu__union__rank_8cpp_html_a45d94ead4cf4e1ff9f87c38bc99f59ae"><div class="ttname"><a href="#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a></div><div class="ttdeci">static void test2()</div><div class="ttdoc">Self-implementations, 2nd test.</div><div class="ttdef"><b>Definition</b> <a href="../../df/d28/dsu__union__rank_8cpp_source.html#l00158">dsu_union_rank.cpp:158</a></div></div>
|
||||
<div class="ttc" id="adsu__union__rank_8cpp_html_ae7880ce913f3058a35ff106d5be9e243"><div class="ttname"><a href="#ae7880ce913f3058a35ff106d5be9e243">test1</a></div><div class="ttdeci">static void test1()</div><div class="ttdoc">Self-implementations, 1st test.</div><div class="ttdef"><b>Definition</b> <a href="../../df/d28/dsu__union__rank_8cpp_source.html#l00134">dsu_union_rank.cpp:134</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae7880ce913f3058a35ff106d5be9e243" name="ae7880ce913f3058a35ff106d5be9e243"></a>
|
||||
@@ -208,11 +226,13 @@ Here is the call graph for this function:</div>
|
||||
<p>< number of elements</p>
|
||||
<p>< object of class disjoint sets</p>
|
||||
<p>< performs union operation on 1 and 2</p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../df/d28/dsu__union__rank_8cpp_source.html#l00134">134</a> of file <a class="el" href="../../df/d28/dsu__union__rank_8cpp_source.html">dsu_union_rank.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 134</span> {</div>
|
||||
<div class="line"><span class="lineno"> 135</span> <span class="comment">/* checks the parents in the resultant structures */</span></div>
|
||||
<div class="line"><span class="lineno"> 136</span> uint64_t n = 10; <span class="comment">///< number of elements</span></div>
|
||||
<div class="line"><span class="lineno"> 137</span> <a class="code hl_class" href="../../dd/d1f/classdsu.html">dsu</a> d(n + 1); <span class="comment">///< object of class disjoint sets</span></div>
|
||||
<div class="line"><span class="lineno"> 138</span> d.unionSet(2, 1); <span class="comment">///< performs union operation on 1 and 2</span></div>
|
||||
<div class="line"><span class="lineno"> 136</span> uint64_t n = 10; </div>
|
||||
<div class="line"><span class="lineno"> 137</span> <a class="code hl_class" href="../../dd/d1f/classdsu.html">dsu</a> d(n + 1); </div>
|
||||
<div class="line"><span class="lineno"> 138</span> d.unionSet(2, 1); </div>
|
||||
<div class="line"><span class="lineno"> 139</span> d.unionSet(1, 4);</div>
|
||||
<div class="line"><span class="lineno"> 140</span> d.unionSet(8, 1);</div>
|
||||
<div class="line"><span class="lineno"> 141</span> d.unionSet(3, 5);</div>
|
||||
@@ -221,23 +241,16 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 144</span> d.unionSet(9, 10);</div>
|
||||
<div class="line"><span class="lineno"> 145</span> d.unionSet(2, 10);</div>
|
||||
<div class="line"><span class="lineno"> 146</span> <span class="comment">// keeping track of the changes using parent pointers</span></div>
|
||||
<div class="line"><span class="lineno"> 147</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector<uint64_t></a> ans = {7, 5};</div>
|
||||
<div class="line"><span class="lineno"> 147</span> vector<uint64_t> ans = {7, 5};</div>
|
||||
<div class="line"><span class="lineno"> 148</span> <span class="keywordflow">for</span> (uint64_t i = 0; i < ans.size(); i++) {</div>
|
||||
<div class="line"><span class="lineno"> 149</span> assert(d.getParents(7).at(i) ==</div>
|
||||
<div class="line"><span class="lineno"> 150</span> ans[i]); <span class="comment">// makes sure algorithm works fine</span></div>
|
||||
<div class="line"><span class="lineno"> 151</span> }</div>
|
||||
<div class="line"><span class="lineno"> 152</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">cout</a> << <span class="stringliteral">"1st test passed!"</span> << <a class="code hl_define" href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 152</span> cout << <span class="stringliteral">"1st test passed!"</span> << <a class="code hl_define" href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 153</span>}</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>
|
||||
<div class="ttc" id="aclassdsu_html"><div class="ttname"><a href="../../dd/d1f/classdsu.html">dsu</a></div><div class="ttdoc">Disjoint sets union data structure, class based representation.</div><div class="ttdef"><b>Definition</b> dsu_path_compression.cpp:34</div></div>
|
||||
<div class="ttc" id="amatrix__exponentiation_8cpp_html_a600eaf353befc174637855795f12d258"><div class="ttname"><a href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a></div><div class="ttdeci">#define endl</div><div class="ttdef"><b>Definition</b> matrix_exponentiation.cpp:36</div></div>
|
||||
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></div></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/d28/dsu__union__rank_8cpp_ae7880ce913f3058a35ff106d5be9e243_cgraph.svg" width="504" height="135"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<div class="ttc" id="aclassdsu_html"><div class="ttname"><a href="../../dd/d1f/classdsu.html">dsu</a></div><div class="ttdoc">Disjoint sets union data structure, class based representation.</div><div class="ttdef"><b>Definition</b> <a href="../../d3/dae/dsu__path__compression_8cpp_source.html#l00034">dsu_path_compression.cpp:34</a></div></div>
|
||||
<div class="ttc" id="amatrix__exponentiation_8cpp_html_a600eaf353befc174637855795f12d258"><div class="ttname"><a href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a></div><div class="ttdeci">#define endl</div><div class="ttdef"><b>Definition</b> <a href="../../d7/d35/matrix__exponentiation_8cpp_source.html#l00036">matrix_exponentiation.cpp:36</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="a45d94ead4cf4e1ff9f87c38bc99f59ae" name="a45d94ead4cf4e1ff9f87c38bc99f59ae"></a>
|
||||
@@ -270,11 +283,13 @@ Here is the call graph for this function:</div>
|
||||
<p>performs union operation on 1 and 2</p>
|
||||
<p>keeping track of the changes using parent pointers</p>
|
||||
<p>makes sure algorithm works fine</p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../df/d28/dsu__union__rank_8cpp_source.html#l00158">158</a> of file <a class="el" href="../../df/d28/dsu__union__rank_8cpp_source.html">dsu_union_rank.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 158</span> {</div>
|
||||
<div class="line"><span class="lineno"> 159</span> <span class="comment">// checks the parents in the resultant structures</span></div>
|
||||
<div class="line"><span class="lineno"> 160</span> uint64_t n = 10; <span class="comment">///< number of elements</span></div>
|
||||
<div class="line"><span class="lineno"> 161</span> <a class="code hl_class" href="../../dd/d1f/classdsu.html">dsu</a> d(n + 1); <span class="comment">///< object of class disjoint sets</span></div>
|
||||
<div class="line"><span class="lineno"> 162</span> d.unionSet(2, 1); <span class="comment">/// performs union operation on 1 and 2</span></div>
|
||||
<div class="line"><span class="lineno"> 160</span> uint64_t n = 10; </div>
|
||||
<div class="line"><span class="lineno"> 161</span> <a class="code hl_class" href="../../dd/d1f/classdsu.html">dsu</a> d(n + 1); </div>
|
||||
<div class="line"><span class="lineno"> 162</span> d.unionSet(2, 1); </div>
|
||||
<div class="line"><span class="lineno"> 163</span> d.unionSet(1, 4);</div>
|
||||
<div class="line"><span class="lineno"> 164</span> d.unionSet(8, 1);</div>
|
||||
<div class="line"><span class="lineno"> 165</span> d.unionSet(3, 5);</div>
|
||||
@@ -282,21 +297,15 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 167</span> d.unionSet(5, 7);</div>
|
||||
<div class="line"><span class="lineno"> 168</span> d.unionSet(9, 10);</div>
|
||||
<div class="line"><span class="lineno"> 169</span> d.unionSet(2, 10);</div>
|
||||
<div class="line"><span class="lineno"> 170</span><span class="comment"></span> </div>
|
||||
<div class="line"><span class="lineno"> 171</span><span class="comment"> /// keeping track of the changes using parent pointers</span></div>
|
||||
<div class="line"><span class="lineno"> 172</span><span class="comment"></span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector<uint64_t></a> ans = {2, 1, 10};</div>
|
||||
<div class="line"><span class="lineno"> 170</span> </div>
|
||||
<div class="line"><span class="lineno"> 172</span> vector<uint64_t> ans = {2, 1, 10};</div>
|
||||
<div class="line"><span class="lineno"> 173</span> <span class="keywordflow">for</span> (uint64_t i = 0; i < ans.size(); i++) {</div>
|
||||
<div class="line"><span class="lineno"> 174</span> assert(d.getParents(2).at(i) ==</div>
|
||||
<div class="line"><span class="lineno"> 175</span> ans[i]); <span class="comment">/// makes sure algorithm works fine</span></div>
|
||||
<div class="line"><span class="lineno"> 175</span> ans[i]); </div>
|
||||
<div class="line"><span class="lineno"> 176</span> }</div>
|
||||
<div class="line"><span class="lineno"> 177</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">cout</a> << <span class="stringliteral">"2nd test passed!"</span> << <a class="code hl_define" href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 177</span> cout << <span class="stringliteral">"2nd test passed!"</span> << <a class="code hl_define" href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a>;</div>
|
||||
<div class="line"><span class="lineno"> 178</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/d28/dsu__union__rank_8cpp_a45d94ead4cf4e1ff9f87c38bc99f59ae_cgraph.svg" width="504" height="135"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<map id="test2" name="test2">
|
||||
<area shape="rect" id="Node000001" title="Self-implementations, 2nd test." alt="" coords="5,31,56,56"/>
|
||||
<area shape="rect" id="Node000002" href="$dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" title="Method to print all the parents of i, or the path from i to representative." alt="" coords="104,5,217,31"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="55,36,88,30,89,35,56,41"/>
|
||||
<area shape="rect" id="Node000003" href="$dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f" title="Method that combines two disjoint sets to which i and j belongs to and make a single set having a com..." alt="" coords="110,55,211,80"/>
|
||||
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="56,45,95,53,94,58,55,51"/>
|
||||
<area shape="rect" id="Node000004" href="$dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c" title="Method to find the representative of the set to which i belongs to, T(n) = O(1)" alt="" coords="407,29,499,55"/>
|
||||
<area shape="poly" id="edge3_Node000003_Node000004" title=" " alt="" coords="206,51,265,40,330,35,392,36,392,41,331,41,265,45,207,57"/>
|
||||
<area shape="rect" id="Node000005" href="$dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" title="A utility function which check whether i and j belongs to same set or not." alt="" coords="265,55,359,80"/>
|
||||
<area shape="poly" id="edge5_Node000003_Node000005" title=" " alt="" coords="211,65,249,65,249,70,211,70"/>
|
||||
<area shape="rect" id="Node000006" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/swap.html#" title=" " alt="" coords="273,104,351,130"/>
|
||||
<area shape="poly" id="edge7_Node000003_Node000006" title=" " alt="" coords="203,78,259,97,258,102,202,84"/>
|
||||
<area shape="poly" id="edge4_Node000004_Node000004" title=" " alt="" coords="429,30,424,21,427,11,437,5,453,3,470,5,480,12,476,16,468,10,453,8,439,10,431,14,429,20,433,28"/>
|
||||
<area shape="poly" id="edge6_Node000005_Node000004" title=" " alt="" coords="359,56,392,50,393,56,360,62"/>
|
||||
</map>
|
||||
@@ -1 +0,0 @@
|
||||
d1e99c0a23b6cc37f6d88d019fd6b459
|
||||
@@ -1,155 +0,0 @@
|
||||
<?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 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: test2 Pages: 1 -->
|
||||
<svg width="378pt" height="101pt"
|
||||
viewBox="0.00 0.00 378.00 101.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
.node, .edge {opacity: 0.7;}
|
||||
.node.selected, .edge.selected {opacity: 1;}
|
||||
.edge:hover path { stroke: red; }
|
||||
.edge:hover polygon { stroke: red; fill: red; }
|
||||
]]></style>
|
||||
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
|
||||
<svg id="graph" class="graph">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 97.25)">
|
||||
<title>test2</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Self-implementations, 2nd test.">
|
||||
<polygon fill="#999999" stroke="#666666" points="37.75,-74.25 0,-74.25 0,-55 37.75,-55 37.75,-74.25"/>
|
||||
<text text-anchor="middle" x="18.88" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">test2</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" target="_top" xlink:title="Method to print all the parents of i, or the path from i to representative.">
|
||||
<polygon fill="white" stroke="#666666" points="158.75,-93.25 73.75,-93.25 73.75,-74 158.75,-74 158.75,-93.25"/>
|
||||
<text text-anchor="middle" x="116.25" y="-79.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::getParents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.81,-68.2C44.87,-69.6 53.38,-71.3 62.13,-73.04"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.28,-76.44 71.77,-74.96 62.65,-69.58 61.28,-76.44"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f" target="_top" xlink:title="Method that combines two disjoint sets to which i and j belongs to and make a single set having a com...">
|
||||
<polygon fill="white" stroke="#666666" points="154.25,-56.25 78.25,-56.25 78.25,-37 154.25,-37 154.25,-56.25"/>
|
||||
<text text-anchor="middle" x="116.25" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::unionSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge2_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.81,-61.24C46.14,-59.67 56.47,-57.72 66.85,-55.76"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="67.37,-59.22 76.55,-53.93 66.07,-52.34 67.37,-59.22"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c" target="_top" xlink:title="Method to find the representative of the set to which i belongs to, T(n) = O(1)">
|
||||
<polygon fill="white" stroke="#666666" points="370,-75.25 301.5,-75.25 301.5,-56 370,-56 370,-75.25"/>
|
||||
<text text-anchor="middle" x="335.75" y="-61.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::findSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node4 -->
|
||||
<g id="edge3_Node000003_Node000004" class="edge">
|
||||
<title>Node3->Node4</title>
|
||||
<g id="a_edge3_Node000003_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M150.88,-56.74C164.38,-60.3 180.17,-63.86 194.75,-65.62 226.42,-69.45 262.42,-69.35 289.98,-68.35"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="289.88,-71.86 299.72,-67.94 289.58,-64.86 289.88,-71.86"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="Node000005" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_Node000005"><a xlink:href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" target="_top" xlink:title="A utility function which check whether i and j belongs to same set or not.">
|
||||
<polygon fill="white" stroke="#666666" points="265.5,-56.25 194.75,-56.25 194.75,-37 265.5,-37 265.5,-56.25"/>
|
||||
<text text-anchor="middle" x="230.12" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::isSame</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node5 -->
|
||||
<g id="edge5_Node000003_Node000005" class="edge">
|
||||
<title>Node3->Node5</title>
|
||||
<g id="a_edge5_Node000003_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M154.5,-46.62C163.63,-46.62 173.51,-46.62 183,-46.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="182.79,-50.13 192.79,-46.63 182.79,-43.13 182.79,-50.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node6 -->
|
||||
<g id="Node000006" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_Node000006"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/algorithm/swap.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="#666666" points="259.5,-19.25 200.75,-19.25 200.75,0 259.5,0 259.5,-19.25"/>
|
||||
<text text-anchor="middle" x="230.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">std::swap</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node6 -->
|
||||
<g id="edge7_Node000003_Node000006" class="edge">
|
||||
<title>Node3->Node6</title>
|
||||
<g id="a_edge7_Node000003_Node000006"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M147.82,-36.51C160.79,-32.23 176.06,-27.17 189.85,-22.61"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="190.68,-26.03 199.08,-19.56 188.48,-19.38 190.68,-26.03"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node4 -->
|
||||
<g id="edge4_Node000004_Node000004" class="edge">
|
||||
<title>Node4->Node4</title>
|
||||
<g id="a_edge4_Node000004_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M319.21,-75.54C311.67,-84.15 317.18,-93.25 335.75,-93.25 345.9,-93.25 352.15,-90.53 354.5,-86.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="357.97,-86.15 352.58,-77.02 351.1,-87.51 357.97,-86.15"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node4 -->
|
||||
<g id="edge6_Node000005_Node000004" class="edge">
|
||||
<title>Node5->Node4</title>
|
||||
<g id="a_edge6_Node000005_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M265.92,-53C273.67,-54.43 282,-55.95 290.08,-57.44"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="289.32,-60.85 299.79,-59.21 290.58,-53.97 289.32,-60.85"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
<style type='text/css'>
|
||||
<![CDATA[
|
||||
[data-mouse-over-selected='false'] { opacity: 0.7; }
|
||||
[data-mouse-over-selected='true'] { opacity: 1.0; }
|
||||
]]>
|
||||
</style>
|
||||
<script type="application/ecmascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
highlightEdges();
|
||||
highlightAdjacentNodes();
|
||||
});
|
||||
]]></script>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 6.8 KiB |
@@ -1,129 +0,0 @@
|
||||
<?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 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: test2 Pages: 1 -->
|
||||
<svg width="378pt" height="101pt"
|
||||
viewBox="0.00 0.00 378.00 101.25" 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 97.25)">
|
||||
<title>test2</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Self-implementations, 2nd test.">
|
||||
<polygon fill="#999999" stroke="#666666" points="37.75,-74.25 0,-74.25 0,-55 37.75,-55 37.75,-74.25"/>
|
||||
<text text-anchor="middle" x="18.88" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">test2</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" target="_top" xlink:title="Method to print all the parents of i, or the path from i to representative.">
|
||||
<polygon fill="white" stroke="#666666" points="158.75,-93.25 73.75,-93.25 73.75,-74 158.75,-74 158.75,-93.25"/>
|
||||
<text text-anchor="middle" x="116.25" y="-79.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::getParents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.81,-68.2C44.87,-69.6 53.38,-71.3 62.13,-73.04"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.28,-76.44 71.77,-74.96 62.65,-69.58 61.28,-76.44"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f" target="_top" xlink:title="Method that combines two disjoint sets to which i and j belongs to and make a single set having a com...">
|
||||
<polygon fill="white" stroke="#666666" points="154.25,-56.25 78.25,-56.25 78.25,-37 154.25,-37 154.25,-56.25"/>
|
||||
<text text-anchor="middle" x="116.25" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::unionSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge2_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.81,-61.24C46.14,-59.67 56.47,-57.72 66.85,-55.76"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="67.37,-59.22 76.55,-53.93 66.07,-52.34 67.37,-59.22"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c" target="_top" xlink:title="Method to find the representative of the set to which i belongs to, T(n) = O(1)">
|
||||
<polygon fill="white" stroke="#666666" points="370,-75.25 301.5,-75.25 301.5,-56 370,-56 370,-75.25"/>
|
||||
<text text-anchor="middle" x="335.75" y="-61.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::findSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node4 -->
|
||||
<g id="edge3_Node000003_Node000004" class="edge">
|
||||
<title>Node3->Node4</title>
|
||||
<g id="a_edge3_Node000003_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M150.88,-56.74C164.38,-60.3 180.17,-63.86 194.75,-65.62 226.42,-69.45 262.42,-69.35 289.98,-68.35"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="289.88,-71.86 299.72,-67.94 289.58,-64.86 289.88,-71.86"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="Node000005" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_Node000005"><a xlink:href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" target="_top" xlink:title="A utility function which check whether i and j belongs to same set or not.">
|
||||
<polygon fill="white" stroke="#666666" points="265.5,-56.25 194.75,-56.25 194.75,-37 265.5,-37 265.5,-56.25"/>
|
||||
<text text-anchor="middle" x="230.12" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::isSame</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node5 -->
|
||||
<g id="edge5_Node000003_Node000005" class="edge">
|
||||
<title>Node3->Node5</title>
|
||||
<g id="a_edge5_Node000003_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M154.5,-46.62C163.63,-46.62 173.51,-46.62 183,-46.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="182.79,-50.13 192.79,-46.63 182.79,-43.13 182.79,-50.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node6 -->
|
||||
<g id="Node000006" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_Node000006"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/algorithm/swap.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="#666666" points="259.5,-19.25 200.75,-19.25 200.75,0 259.5,0 259.5,-19.25"/>
|
||||
<text text-anchor="middle" x="230.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">std::swap</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node6 -->
|
||||
<g id="edge7_Node000003_Node000006" class="edge">
|
||||
<title>Node3->Node6</title>
|
||||
<g id="a_edge7_Node000003_Node000006"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M147.82,-36.51C160.79,-32.23 176.06,-27.17 189.85,-22.61"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="190.68,-26.03 199.08,-19.56 188.48,-19.38 190.68,-26.03"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node4 -->
|
||||
<g id="edge4_Node000004_Node000004" class="edge">
|
||||
<title>Node4->Node4</title>
|
||||
<g id="a_edge4_Node000004_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M319.21,-75.54C311.67,-84.15 317.18,-93.25 335.75,-93.25 345.9,-93.25 352.15,-90.53 354.5,-86.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="357.97,-86.15 352.58,-77.02 351.1,-87.51 357.97,-86.15"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node4 -->
|
||||
<g id="edge6_Node000005_Node000004" class="edge">
|
||||
<title>Node5->Node4</title>
|
||||
<g id="a_edge6_Node000005_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M265.92,-53C273.67,-54.43 282,-55.95 290.08,-57.44"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="289.32,-60.85 299.79,-59.21 290.58,-53.97 289.32,-60.85"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 6.1 KiB |
@@ -1,21 +0,0 @@
|
||||
<map id="main" name="main">
|
||||
<area shape="rect" id="Node000001" title="Main function." alt="" coords="5,32,55,58"/>
|
||||
<area shape="rect" id="Node000002" href="$df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243" title="Self-implementations, 1st test." alt="" coords="103,7,153,32"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="54,36,87,27,89,32,56,41"/>
|
||||
<area shape="rect" id="Node000008" href="$df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae" title="Self-implementations, 2nd test." alt="" coords="103,56,153,82"/>
|
||||
<area shape="poly" id="edge9_Node000001_Node000008" title=" " alt="" coords="56,48,89,57,87,62,54,53"/>
|
||||
<area shape="rect" id="Node000003" href="$dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" title="Method to print all the parents of i, or the path from i to representative." alt="" coords="201,7,314,32"/>
|
||||
<area shape="poly" id="edge2_Node000002_Node000003" title=" " alt="" coords="153,17,185,17,185,22,153,22"/>
|
||||
<area shape="rect" id="Node000004" href="$dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f" title="Method that combines two disjoint sets to which i and j belongs to and make a single set having a com..." alt="" coords="207,56,308,82"/>
|
||||
<area shape="poly" id="edge3_Node000002_Node000004" title=" " alt="" coords="154,26,209,48,207,53,152,31"/>
|
||||
<area shape="rect" id="Node000005" href="$dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c" title="Method to find the representative of the set to which i belongs to, T(n) = O(1)" alt="" coords="505,31,596,56"/>
|
||||
<area shape="poly" id="edge4_Node000004_Node000005" title=" " alt="" coords="309,62,489,46,489,51,309,67"/>
|
||||
<area shape="rect" id="Node000006" href="$dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" title="A utility function which check whether i and j belongs to same set or not." alt="" coords="362,5,457,31"/>
|
||||
<area shape="poly" id="edge6_Node000004_Node000006" title=" " alt="" coords="298,53,354,34,355,39,299,58"/>
|
||||
<area shape="rect" id="Node000007" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/swap.html#" title=" " alt="" coords="370,107,449,132"/>
|
||||
<area shape="poly" id="edge8_Node000004_Node000007" title=" " alt="" coords="299,80,356,99,355,104,298,85"/>
|
||||
<area shape="poly" id="edge5_Node000005_Node000005" title=" " alt="" coords="526,31,521,22,524,13,534,6,550,4,568,7,577,13,574,18,566,12,550,9,536,11,528,16,527,22,531,29"/>
|
||||
<area shape="poly" id="edge7_Node000006_Node000005" title=" " alt="" coords="458,24,490,30,489,35,457,29"/>
|
||||
<area shape="poly" id="edge10_Node000008_Node000003" title=" " alt="" coords="152,57,207,36,209,41,154,62"/>
|
||||
<area shape="poly" id="edge11_Node000008_Node000004" title=" " alt="" coords="153,66,192,66,192,72,153,72"/>
|
||||
</map>
|
||||
@@ -1 +0,0 @@
|
||||
dac6f7ebedee78270a24ea5e106a593a
|
||||
@@ -1,209 +0,0 @@
|
||||
<?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 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="451pt" height="103pt"
|
||||
viewBox="0.00 0.00 451.00 103.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
.node, .edge {opacity: 0.7;}
|
||||
.node.selected, .edge.selected {opacity: 1;}
|
||||
.edge:hover path { stroke: red; }
|
||||
.edge:hover polygon { stroke: red; fill: red; }
|
||||
]]></style>
|
||||
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
|
||||
<svg id="graph" class="graph">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 99.25)">
|
||||
<title>main</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Main function.">
|
||||
<polygon fill="#999999" stroke="#666666" points="37,-75.25 0,-75.25 0,-56 37,-56 37,-75.25"/>
|
||||
<text text-anchor="middle" x="18.5" y="-61.75" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243" target="_top" xlink:title="Self-implementations, 1st test.">
|
||||
<polygon fill="white" stroke="#666666" points="110.75,-94.25 73,-94.25 73,-75 110.75,-75 110.75,-94.25"/>
|
||||
<text text-anchor="middle" x="91.88" y="-80.75" font-family="Helvetica,sans-Serif" font-size="10.00">test1</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.14,-70.32C44.64,-72.32 53.57,-74.69 61.98,-76.93"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="60.91,-80.27 71.48,-79.46 62.71,-73.51 60.91,-80.27"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node8 -->
|
||||
<g id="Node000008" class="node">
|
||||
<title>Node8</title>
|
||||
<g id="a_Node000008"><a xlink:href="../../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae" target="_top" xlink:title="Self-implementations, 2nd test.">
|
||||
<polygon fill="white" stroke="#666666" points="110.75,-57.25 73,-57.25 73,-38 110.75,-38 110.75,-57.25"/>
|
||||
<text text-anchor="middle" x="91.88" y="-43.75" font-family="Helvetica,sans-Serif" font-size="10.00">test2</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node8 -->
|
||||
<g id="edge9_Node000001_Node000008" class="edge">
|
||||
<title>Node1->Node8</title>
|
||||
<g id="a_edge9_Node000001_Node000008"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.14,-61.18C44.64,-59.29 53.57,-57.03 61.98,-54.91"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="62.63,-58.36 71.47,-52.52 60.92,-51.57 62.63,-58.36"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" target="_top" xlink:title="Method to print all the parents of i, or the path from i to representative.">
|
||||
<polygon fill="white" stroke="#666666" points="231.75,-94.25 146.75,-94.25 146.75,-75 231.75,-75 231.75,-94.25"/>
|
||||
<text text-anchor="middle" x="189.25" y="-80.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::getParents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node3 -->
|
||||
<g id="edge2_Node000002_Node000003" class="edge">
|
||||
<title>Node2->Node3</title>
|
||||
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M110.81,-84.62C117.79,-84.62 126.19,-84.62 134.84,-84.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="134.74,-88.13 144.74,-84.63 134.74,-81.13 134.74,-88.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f" target="_top" xlink:title="Method that combines two disjoint sets to which i and j belongs to and make a single set having a com...">
|
||||
<polygon fill="white" stroke="#666666" points="227.25,-57.25 151.25,-57.25 151.25,-38 227.25,-38 227.25,-57.25"/>
|
||||
<text text-anchor="middle" x="189.25" y="-43.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::unionSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node4 -->
|
||||
<g id="edge3_Node000002_Node000004" class="edge">
|
||||
<title>Node2->Node4</title>
|
||||
<g id="a_edge3_Node000002_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M110.81,-77.67C122.42,-73.16 137.95,-67.14 152.05,-61.67"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="153,-65.05 161.06,-58.17 150.47,-58.53 153,-65.05"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="Node000005" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_Node000005"><a xlink:href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c" target="_top" xlink:title="Method to find the representative of the set to which i belongs to, T(n) = O(1)">
|
||||
<polygon fill="white" stroke="#666666" points="443,-76.25 374.5,-76.25 374.5,-57 443,-57 443,-76.25"/>
|
||||
<text text-anchor="middle" x="408.75" y="-62.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::findSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node5 -->
|
||||
<g id="edge4_Node000004_Node000005" class="edge">
|
||||
<title>Node4->Node5</title>
|
||||
<g id="a_edge4_Node000004_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M227.64,-50.89C265.11,-54.16 322.83,-59.21 362.78,-62.7"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="362.28,-66.17 372.55,-63.55 362.89,-59.19 362.28,-66.17"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node6 -->
|
||||
<g id="Node000006" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_Node000006"><a xlink:href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" target="_top" xlink:title="A utility function which check whether i and j belongs to same set or not.">
|
||||
<polygon fill="white" stroke="#666666" points="338.5,-95.25 267.75,-95.25 267.75,-76 338.5,-76 338.5,-95.25"/>
|
||||
<text text-anchor="middle" x="303.12" y="-81.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::isSame</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node6 -->
|
||||
<g id="edge6_Node000004_Node000006" class="edge">
|
||||
<title>Node4->Node6</title>
|
||||
<g id="a_edge6_Node000004_Node000006"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M219.94,-57.71C232.81,-62.08 248.08,-67.27 261.94,-71.98"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="260.66,-75.24 271.25,-75.14 262.91,-68.61 260.66,-75.24"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node7 -->
|
||||
<g id="Node000007" class="node">
|
||||
<title>Node7</title>
|
||||
<g id="a_Node000007"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/algorithm/swap.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="#666666" points="332.5,-19.25 273.75,-19.25 273.75,0 332.5,0 332.5,-19.25"/>
|
||||
<text text-anchor="middle" x="303.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">std::swap</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node7 -->
|
||||
<g id="edge8_Node000004_Node000007" class="edge">
|
||||
<title>Node4->Node7</title>
|
||||
<g id="a_edge8_Node000004_Node000007"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M219.94,-37.54C233.01,-33.1 248.56,-27.82 262.6,-23.05"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="263.68,-26.38 272.03,-19.85 261.43,-19.75 263.68,-26.38"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node5 -->
|
||||
<g id="edge5_Node000005_Node000005" class="edge">
|
||||
<title>Node5->Node5</title>
|
||||
<g id="a_edge5_Node000005_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M392.21,-76.54C384.67,-85.15 390.18,-94.25 408.75,-94.25 418.9,-94.25 425.15,-91.53 427.5,-87.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="430.97,-87.15 425.58,-78.02 424.1,-88.51 430.97,-87.15"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node6->Node5 -->
|
||||
<g id="edge7_Node000006_Node000005" class="edge">
|
||||
<title>Node6->Node5</title>
|
||||
<g id="a_edge7_Node000006_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M338.92,-79.25C346.67,-77.82 355,-76.3 363.08,-74.81"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="363.58,-78.28 372.79,-73.04 362.32,-71.4 363.58,-78.28"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node8->Node3 -->
|
||||
<g id="edge10_Node000008_Node000003" class="edge">
|
||||
<title>Node8->Node3</title>
|
||||
<g id="a_edge10_Node000008_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M110.81,-54.58C122.42,-59.09 137.95,-65.11 152.05,-70.58"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="150.47,-73.72 161.06,-74.08 153,-67.2 150.47,-73.72"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node8->Node4 -->
|
||||
<g id="edge11_Node000008_Node000004" class="edge">
|
||||
<title>Node8->Node4</title>
|
||||
<g id="a_edge11_Node000008_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M110.81,-47.62C119.14,-47.62 129.47,-47.62 139.85,-47.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="139.52,-51.13 149.52,-47.63 139.52,-44.13 139.52,-51.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
<style type='text/css'>
|
||||
<![CDATA[
|
||||
[data-mouse-over-selected='false'] { opacity: 0.7; }
|
||||
[data-mouse-over-selected='true'] { opacity: 1.0; }
|
||||
]]>
|
||||
</style>
|
||||
<script type="application/ecmascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
highlightEdges();
|
||||
highlightAdjacentNodes();
|
||||
});
|
||||
]]></script>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 9.2 KiB |
@@ -1,183 +0,0 @@
|
||||
<?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 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="451pt" height="103pt"
|
||||
viewBox="0.00 0.00 451.00 103.25" 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 99.25)">
|
||||
<title>main</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Main function.">
|
||||
<polygon fill="#999999" stroke="#666666" points="37,-75.25 0,-75.25 0,-56 37,-56 37,-75.25"/>
|
||||
<text text-anchor="middle" x="18.5" y="-61.75" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243" target="_top" xlink:title="Self-implementations, 1st test.">
|
||||
<polygon fill="white" stroke="#666666" points="110.75,-94.25 73,-94.25 73,-75 110.75,-75 110.75,-94.25"/>
|
||||
<text text-anchor="middle" x="91.88" y="-80.75" font-family="Helvetica,sans-Serif" font-size="10.00">test1</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.14,-70.32C44.64,-72.32 53.57,-74.69 61.98,-76.93"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="60.91,-80.27 71.48,-79.46 62.71,-73.51 60.91,-80.27"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node8 -->
|
||||
<g id="Node000008" class="node">
|
||||
<title>Node8</title>
|
||||
<g id="a_Node000008"><a xlink:href="../../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae" target="_top" xlink:title="Self-implementations, 2nd test.">
|
||||
<polygon fill="white" stroke="#666666" points="110.75,-57.25 73,-57.25 73,-38 110.75,-38 110.75,-57.25"/>
|
||||
<text text-anchor="middle" x="91.88" y="-43.75" font-family="Helvetica,sans-Serif" font-size="10.00">test2</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node8 -->
|
||||
<g id="edge9_Node000001_Node000008" class="edge">
|
||||
<title>Node1->Node8</title>
|
||||
<g id="a_edge9_Node000001_Node000008"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.14,-61.18C44.64,-59.29 53.57,-57.03 61.98,-54.91"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="62.63,-58.36 71.47,-52.52 60.92,-51.57 62.63,-58.36"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" target="_top" xlink:title="Method to print all the parents of i, or the path from i to representative.">
|
||||
<polygon fill="white" stroke="#666666" points="231.75,-94.25 146.75,-94.25 146.75,-75 231.75,-75 231.75,-94.25"/>
|
||||
<text text-anchor="middle" x="189.25" y="-80.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::getParents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node3 -->
|
||||
<g id="edge2_Node000002_Node000003" class="edge">
|
||||
<title>Node2->Node3</title>
|
||||
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M110.81,-84.62C117.79,-84.62 126.19,-84.62 134.84,-84.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="134.74,-88.13 144.74,-84.63 134.74,-81.13 134.74,-88.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f" target="_top" xlink:title="Method that combines two disjoint sets to which i and j belongs to and make a single set having a com...">
|
||||
<polygon fill="white" stroke="#666666" points="227.25,-57.25 151.25,-57.25 151.25,-38 227.25,-38 227.25,-57.25"/>
|
||||
<text text-anchor="middle" x="189.25" y="-43.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::unionSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node4 -->
|
||||
<g id="edge3_Node000002_Node000004" class="edge">
|
||||
<title>Node2->Node4</title>
|
||||
<g id="a_edge3_Node000002_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M110.81,-77.67C122.42,-73.16 137.95,-67.14 152.05,-61.67"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="153,-65.05 161.06,-58.17 150.47,-58.53 153,-65.05"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="Node000005" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_Node000005"><a xlink:href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c" target="_top" xlink:title="Method to find the representative of the set to which i belongs to, T(n) = O(1)">
|
||||
<polygon fill="white" stroke="#666666" points="443,-76.25 374.5,-76.25 374.5,-57 443,-57 443,-76.25"/>
|
||||
<text text-anchor="middle" x="408.75" y="-62.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::findSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node5 -->
|
||||
<g id="edge4_Node000004_Node000005" class="edge">
|
||||
<title>Node4->Node5</title>
|
||||
<g id="a_edge4_Node000004_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M227.64,-50.89C265.11,-54.16 322.83,-59.21 362.78,-62.7"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="362.28,-66.17 372.55,-63.55 362.89,-59.19 362.28,-66.17"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node6 -->
|
||||
<g id="Node000006" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_Node000006"><a xlink:href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" target="_top" xlink:title="A utility function which check whether i and j belongs to same set or not.">
|
||||
<polygon fill="white" stroke="#666666" points="338.5,-95.25 267.75,-95.25 267.75,-76 338.5,-76 338.5,-95.25"/>
|
||||
<text text-anchor="middle" x="303.12" y="-81.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::isSame</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node6 -->
|
||||
<g id="edge6_Node000004_Node000006" class="edge">
|
||||
<title>Node4->Node6</title>
|
||||
<g id="a_edge6_Node000004_Node000006"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M219.94,-57.71C232.81,-62.08 248.08,-67.27 261.94,-71.98"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="260.66,-75.24 271.25,-75.14 262.91,-68.61 260.66,-75.24"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node7 -->
|
||||
<g id="Node000007" class="node">
|
||||
<title>Node7</title>
|
||||
<g id="a_Node000007"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/algorithm/swap.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="#666666" points="332.5,-19.25 273.75,-19.25 273.75,0 332.5,0 332.5,-19.25"/>
|
||||
<text text-anchor="middle" x="303.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">std::swap</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node7 -->
|
||||
<g id="edge8_Node000004_Node000007" class="edge">
|
||||
<title>Node4->Node7</title>
|
||||
<g id="a_edge8_Node000004_Node000007"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M219.94,-37.54C233.01,-33.1 248.56,-27.82 262.6,-23.05"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="263.68,-26.38 272.03,-19.85 261.43,-19.75 263.68,-26.38"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node5 -->
|
||||
<g id="edge5_Node000005_Node000005" class="edge">
|
||||
<title>Node5->Node5</title>
|
||||
<g id="a_edge5_Node000005_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M392.21,-76.54C384.67,-85.15 390.18,-94.25 408.75,-94.25 418.9,-94.25 425.15,-91.53 427.5,-87.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="430.97,-87.15 425.58,-78.02 424.1,-88.51 430.97,-87.15"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node6->Node5 -->
|
||||
<g id="edge7_Node000006_Node000005" class="edge">
|
||||
<title>Node6->Node5</title>
|
||||
<g id="a_edge7_Node000006_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M338.92,-79.25C346.67,-77.82 355,-76.3 363.08,-74.81"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="363.58,-78.28 372.79,-73.04 362.32,-71.4 363.58,-78.28"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node8->Node3 -->
|
||||
<g id="edge10_Node000008_Node000003" class="edge">
|
||||
<title>Node8->Node3</title>
|
||||
<g id="a_edge10_Node000008_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M110.81,-54.58C122.42,-59.09 137.95,-65.11 152.05,-70.58"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="150.47,-73.72 161.06,-74.08 153,-67.2 150.47,-73.72"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node8->Node4 -->
|
||||
<g id="edge11_Node000008_Node000004" class="edge">
|
||||
<title>Node8->Node4</title>
|
||||
<g id="a_edge11_Node000008_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M110.81,-47.62C119.14,-47.62 129.47,-47.62 139.85,-47.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="139.52,-51.13 149.52,-47.63 139.52,-44.13 139.52,-51.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 8.5 KiB |
@@ -1,15 +0,0 @@
|
||||
<map id="test1" name="test1">
|
||||
<area shape="rect" id="Node000001" title="Self-implementations, 1st test." alt="" coords="5,31,56,56"/>
|
||||
<area shape="rect" id="Node000002" href="$dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" title="Method to print all the parents of i, or the path from i to representative." alt="" coords="104,5,217,31"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="55,36,88,30,89,35,56,41"/>
|
||||
<area shape="rect" id="Node000003" href="$dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f" title="Method that combines two disjoint sets to which i and j belongs to and make a single set having a com..." alt="" coords="110,55,211,80"/>
|
||||
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="56,45,95,53,94,58,55,51"/>
|
||||
<area shape="rect" id="Node000004" href="$dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c" title="Method to find the representative of the set to which i belongs to, T(n) = O(1)" alt="" coords="407,29,499,55"/>
|
||||
<area shape="poly" id="edge3_Node000003_Node000004" title=" " alt="" coords="206,51,265,40,330,35,392,36,392,41,331,41,265,45,207,57"/>
|
||||
<area shape="rect" id="Node000005" href="$dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" title="A utility function which check whether i and j belongs to same set or not." alt="" coords="265,55,359,80"/>
|
||||
<area shape="poly" id="edge5_Node000003_Node000005" title=" " alt="" coords="211,65,249,65,249,70,211,70"/>
|
||||
<area shape="rect" id="Node000006" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/swap.html#" title=" " alt="" coords="273,104,351,130"/>
|
||||
<area shape="poly" id="edge7_Node000003_Node000006" title=" " alt="" coords="203,78,259,97,258,102,202,84"/>
|
||||
<area shape="poly" id="edge4_Node000004_Node000004" title=" " alt="" coords="429,30,424,21,427,11,437,5,453,3,470,5,480,12,476,16,468,10,453,8,439,10,431,14,429,20,433,28"/>
|
||||
<area shape="poly" id="edge6_Node000005_Node000004" title=" " alt="" coords="359,56,392,50,393,56,360,62"/>
|
||||
</map>
|
||||
@@ -1 +0,0 @@
|
||||
ab21a1520d6bf943e1068afc32495f26
|
||||
@@ -1,155 +0,0 @@
|
||||
<?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 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: test1 Pages: 1 -->
|
||||
<svg width="378pt" height="101pt"
|
||||
viewBox="0.00 0.00 378.00 101.25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
.node, .edge {opacity: 0.7;}
|
||||
.node.selected, .edge.selected {opacity: 1;}
|
||||
.edge:hover path { stroke: red; }
|
||||
.edge:hover polygon { stroke: red; fill: red; }
|
||||
]]></style>
|
||||
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
|
||||
<svg id="graph" class="graph">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 97.25)">
|
||||
<title>test1</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Self-implementations, 1st test.">
|
||||
<polygon fill="#999999" stroke="#666666" points="37.75,-74.25 0,-74.25 0,-55 37.75,-55 37.75,-74.25"/>
|
||||
<text text-anchor="middle" x="18.88" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">test1</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" target="_top" xlink:title="Method to print all the parents of i, or the path from i to representative.">
|
||||
<polygon fill="white" stroke="#666666" points="158.75,-93.25 73.75,-93.25 73.75,-74 158.75,-74 158.75,-93.25"/>
|
||||
<text text-anchor="middle" x="116.25" y="-79.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::getParents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.81,-68.2C44.87,-69.6 53.38,-71.3 62.13,-73.04"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.28,-76.44 71.77,-74.96 62.65,-69.58 61.28,-76.44"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f" target="_top" xlink:title="Method that combines two disjoint sets to which i and j belongs to and make a single set having a com...">
|
||||
<polygon fill="white" stroke="#666666" points="154.25,-56.25 78.25,-56.25 78.25,-37 154.25,-37 154.25,-56.25"/>
|
||||
<text text-anchor="middle" x="116.25" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::unionSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge2_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.81,-61.24C46.14,-59.67 56.47,-57.72 66.85,-55.76"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="67.37,-59.22 76.55,-53.93 66.07,-52.34 67.37,-59.22"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c" target="_top" xlink:title="Method to find the representative of the set to which i belongs to, T(n) = O(1)">
|
||||
<polygon fill="white" stroke="#666666" points="370,-75.25 301.5,-75.25 301.5,-56 370,-56 370,-75.25"/>
|
||||
<text text-anchor="middle" x="335.75" y="-61.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::findSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node4 -->
|
||||
<g id="edge3_Node000003_Node000004" class="edge">
|
||||
<title>Node3->Node4</title>
|
||||
<g id="a_edge3_Node000003_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M150.88,-56.74C164.38,-60.3 180.17,-63.86 194.75,-65.62 226.42,-69.45 262.42,-69.35 289.98,-68.35"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="289.88,-71.86 299.72,-67.94 289.58,-64.86 289.88,-71.86"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="Node000005" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_Node000005"><a xlink:href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" target="_top" xlink:title="A utility function which check whether i and j belongs to same set or not.">
|
||||
<polygon fill="white" stroke="#666666" points="265.5,-56.25 194.75,-56.25 194.75,-37 265.5,-37 265.5,-56.25"/>
|
||||
<text text-anchor="middle" x="230.12" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::isSame</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node5 -->
|
||||
<g id="edge5_Node000003_Node000005" class="edge">
|
||||
<title>Node3->Node5</title>
|
||||
<g id="a_edge5_Node000003_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M154.5,-46.62C163.63,-46.62 173.51,-46.62 183,-46.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="182.79,-50.13 192.79,-46.63 182.79,-43.13 182.79,-50.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node6 -->
|
||||
<g id="Node000006" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_Node000006"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/algorithm/swap.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="#666666" points="259.5,-19.25 200.75,-19.25 200.75,0 259.5,0 259.5,-19.25"/>
|
||||
<text text-anchor="middle" x="230.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">std::swap</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node6 -->
|
||||
<g id="edge7_Node000003_Node000006" class="edge">
|
||||
<title>Node3->Node6</title>
|
||||
<g id="a_edge7_Node000003_Node000006"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M147.82,-36.51C160.79,-32.23 176.06,-27.17 189.85,-22.61"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="190.68,-26.03 199.08,-19.56 188.48,-19.38 190.68,-26.03"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node4 -->
|
||||
<g id="edge4_Node000004_Node000004" class="edge">
|
||||
<title>Node4->Node4</title>
|
||||
<g id="a_edge4_Node000004_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M319.21,-75.54C311.67,-84.15 317.18,-93.25 335.75,-93.25 345.9,-93.25 352.15,-90.53 354.5,-86.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="357.97,-86.15 352.58,-77.02 351.1,-87.51 357.97,-86.15"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node4 -->
|
||||
<g id="edge6_Node000005_Node000004" class="edge">
|
||||
<title>Node5->Node4</title>
|
||||
<g id="a_edge6_Node000005_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M265.92,-53C273.67,-54.43 282,-55.95 290.08,-57.44"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="289.32,-60.85 299.79,-59.21 290.58,-53.97 289.32,-60.85"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
<style type='text/css'>
|
||||
<![CDATA[
|
||||
[data-mouse-over-selected='false'] { opacity: 0.7; }
|
||||
[data-mouse-over-selected='true'] { opacity: 1.0; }
|
||||
]]>
|
||||
</style>
|
||||
<script type="application/ecmascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
highlightEdges();
|
||||
highlightAdjacentNodes();
|
||||
});
|
||||
]]></script>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 6.8 KiB |
@@ -1,129 +0,0 @@
|
||||
<?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 12.1.2 (20240928.0832)
|
||||
-->
|
||||
<!-- Title: test1 Pages: 1 -->
|
||||
<svg width="378pt" height="101pt"
|
||||
viewBox="0.00 0.00 378.00 101.25" 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 97.25)">
|
||||
<title>test1</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Self-implementations, 1st test.">
|
||||
<polygon fill="#999999" stroke="#666666" points="37.75,-74.25 0,-74.25 0,-55 37.75,-55 37.75,-74.25"/>
|
||||
<text text-anchor="middle" x="18.88" y="-60.75" font-family="Helvetica,sans-Serif" font-size="10.00">test1</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" target="_top" xlink:title="Method to print all the parents of i, or the path from i to representative.">
|
||||
<polygon fill="white" stroke="#666666" points="158.75,-93.25 73.75,-93.25 73.75,-74 158.75,-74 158.75,-93.25"/>
|
||||
<text text-anchor="middle" x="116.25" y="-79.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::getParents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.81,-68.2C44.87,-69.6 53.38,-71.3 62.13,-73.04"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="61.28,-76.44 71.77,-74.96 62.65,-69.58 61.28,-76.44"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="Node000003" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_Node000003"><a xlink:href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f" target="_top" xlink:title="Method that combines two disjoint sets to which i and j belongs to and make a single set having a com...">
|
||||
<polygon fill="white" stroke="#666666" points="154.25,-56.25 78.25,-56.25 78.25,-37 154.25,-37 154.25,-56.25"/>
|
||||
<text text-anchor="middle" x="116.25" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::unionSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge2_Node000001_Node000003" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<g id="a_edge2_Node000001_Node000003"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M37.81,-61.24C46.14,-59.67 56.47,-57.72 66.85,-55.76"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="67.37,-59.22 76.55,-53.93 66.07,-52.34 67.37,-59.22"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="Node000004" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_Node000004"><a xlink:href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c" target="_top" xlink:title="Method to find the representative of the set to which i belongs to, T(n) = O(1)">
|
||||
<polygon fill="white" stroke="#666666" points="370,-75.25 301.5,-75.25 301.5,-56 370,-56 370,-75.25"/>
|
||||
<text text-anchor="middle" x="335.75" y="-61.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::findSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node4 -->
|
||||
<g id="edge3_Node000003_Node000004" class="edge">
|
||||
<title>Node3->Node4</title>
|
||||
<g id="a_edge3_Node000003_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M150.88,-56.74C164.38,-60.3 180.17,-63.86 194.75,-65.62 226.42,-69.45 262.42,-69.35 289.98,-68.35"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="289.88,-71.86 299.72,-67.94 289.58,-64.86 289.88,-71.86"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="Node000005" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_Node000005"><a xlink:href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" target="_top" xlink:title="A utility function which check whether i and j belongs to same set or not.">
|
||||
<polygon fill="white" stroke="#666666" points="265.5,-56.25 194.75,-56.25 194.75,-37 265.5,-37 265.5,-56.25"/>
|
||||
<text text-anchor="middle" x="230.12" y="-42.75" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::isSame</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node5 -->
|
||||
<g id="edge5_Node000003_Node000005" class="edge">
|
||||
<title>Node3->Node5</title>
|
||||
<g id="a_edge5_Node000003_Node000005"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M154.5,-46.62C163.63,-46.62 173.51,-46.62 183,-46.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="182.79,-50.13 192.79,-46.63 182.79,-43.13 182.79,-50.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node6 -->
|
||||
<g id="Node000006" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_Node000006"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/algorithm/swap.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="#666666" points="259.5,-19.25 200.75,-19.25 200.75,0 259.5,0 259.5,-19.25"/>
|
||||
<text text-anchor="middle" x="230.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">std::swap</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node6 -->
|
||||
<g id="edge7_Node000003_Node000006" class="edge">
|
||||
<title>Node3->Node6</title>
|
||||
<g id="a_edge7_Node000003_Node000006"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M147.82,-36.51C160.79,-32.23 176.06,-27.17 189.85,-22.61"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="190.68,-26.03 199.08,-19.56 188.48,-19.38 190.68,-26.03"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node4 -->
|
||||
<g id="edge4_Node000004_Node000004" class="edge">
|
||||
<title>Node4->Node4</title>
|
||||
<g id="a_edge4_Node000004_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M319.21,-75.54C311.67,-84.15 317.18,-93.25 335.75,-93.25 345.9,-93.25 352.15,-90.53 354.5,-86.65"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="357.97,-86.15 352.58,-77.02 351.1,-87.51 357.97,-86.15"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node4 -->
|
||||
<g id="edge6_Node000005_Node000004" class="edge">
|
||||
<title>Node5->Node4</title>
|
||||
<g id="a_edge6_Node000005_Node000004"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M265.92,-53C273.67,-54.43 282,-55.95 290.08,-57.44"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="289.32,-60.85 299.79,-59.21 290.58,-53.97 289.32,-60.85"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 6.1 KiB |
277
df/d28/dsu__union__rank_8cpp_source.html
Normal file
277
df/d28/dsu__union__rank_8cpp_source.html
Normal file
@@ -0,0 +1,277 @@
|
||||
<!-- HTML header for doxygen 1.12.0-->
|
||||
<!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" lang="en-US">
|
||||
<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.12.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TheAlgorithms/C++: data_structures/dsu_union_rank.cpp Source File</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
<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="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
|
||||
<script type="text/javascript">
|
||||
DoxygenAwesomeDarkModeToggle.init()
|
||||
</script>
|
||||
<script type="text/javascript" src="../../clipboard.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||||
<script type="text/javascript" src="../../navtree.js"></script>
|
||||
<script type="text/javascript" src="../../resize.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>
|
||||
<script type="text/javascript">
|
||||
window.MathJax = {
|
||||
options: {
|
||||
ignoreHtmlClass: 'tex2jax_ignore',
|
||||
processHtmlClass: 'tex2jax_process'
|
||||
},
|
||||
loader: {
|
||||
load: ['[tex]/ams']
|
||||
},
|
||||
tex: {
|
||||
macros: {},
|
||||
packages: ['base','configmacros','ams']
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
|
||||
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../../doxygen-awesome.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 id="projectrow">
|
||||
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
|
||||
<td id="projectalign">
|
||||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">All the algorithms implemented in C++</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.12.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() { codefold.init(1); });
|
||||
/* @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:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search',true);
|
||||
$(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:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function(){initNavTree('df/d28/dsu__union__rank_8cpp_source.html','../../'); initResizable(true); });
|
||||
/* @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">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle"><div class="title">dsu_union_rank.cpp</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<a href="../../df/d28/dsu__union__rank_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include <cassert></span> </div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="preprocessor">#include <cstdint></span></div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#include <iostream></span> </div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="preprocessor">#include <vector></span> </div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> </div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span><span class="keyword">using </span>std::cout;</div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="keyword">using </span>std::endl;</div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="keyword">using </span>std::vector;</div>
|
||||
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span><span class="keyword">class </span><a class="code hl_class" href="../../dd/d1f/classdsu.html">dsu</a> {</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keyword">private</span>:</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> vector<uint64_t> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a1ef0b0462a0dda63514f641cbb7dd8cb">p</a>; </div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> vector<uint64_t> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a4bf54d33fba178998dbbe4c57f2e9429">depth</a>; </div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> vector<uint64_t> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#ac0dc3e17e49fe19b159b4ea4096d7b55">setSize</a>; </div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keyword">public</span>:</div>
|
||||
<div class="foldopen" id="foldopen00045" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"><a class="line" href="../../dd/d1f/classdsu.html#a126e3002a464e53cd54b07ba56482a72"> 45</a></span> <span class="keyword">explicit</span> <a class="code hl_function" href="../../dd/d1f/classdsu.html#a126e3002a464e53cd54b07ba56482a72">dsu</a>(uint64_t n) {</div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a1ef0b0462a0dda63514f641cbb7dd8cb">p</a>.assign(n, 0);</div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a4bf54d33fba178998dbbe4c57f2e9429">depth</a>.assign(n, 0);</div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#ac0dc3e17e49fe19b159b4ea4096d7b55">setSize</a>.assign(n, 0);</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">for</span> (uint64_t i = 0; i < n; i++) {</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a1ef0b0462a0dda63514f641cbb7dd8cb">p</a>[i] = i;</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a4bf54d33fba178998dbbe4c57f2e9429">depth</a>[i] = 0;</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#ac0dc3e17e49fe19b159b4ea4096d7b55">setSize</a>[i] = 1;</div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> }</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> }</div>
|
||||
</div>
|
||||
<div class="foldopen" id="foldopen00062" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"><a class="line" href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c"> 62</a></span> uint64_t <a class="code hl_function" href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c">findSet</a>(uint64_t i) {</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordflow">while</span> (i != <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a1ef0b0462a0dda63514f641cbb7dd8cb">p</a>[i]) {</div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> i = <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a1ef0b0462a0dda63514f641cbb7dd8cb">p</a>[i];</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> }</div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="keywordflow">return</span> i;</div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> }</div>
|
||||
</div>
|
||||
<div class="foldopen" id="foldopen00076" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"><a class="line" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f"> 76</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(uint64_t i, uint64_t j) {</div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303">isSame</a>(i, j)) {</div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> }</div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> uint64_t x = <a class="code hl_function" href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c">findSet</a>(i);</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> uint64_t y = <a class="code hl_function" href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c">findSet</a>(j);</div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> </div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../dd/d1f/classdsu.html#a4bf54d33fba178998dbbe4c57f2e9429">depth</a>[x] > <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a4bf54d33fba178998dbbe4c57f2e9429">depth</a>[y]) {</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> std::swap(x, y);</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> }</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a1ef0b0462a0dda63514f641cbb7dd8cb">p</a>[x] = y;</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> </div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../dd/d1f/classdsu.html#a4bf54d33fba178998dbbe4c57f2e9429">depth</a>[x] == <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a4bf54d33fba178998dbbe4c57f2e9429">depth</a>[y]) {</div>
|
||||
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a4bf54d33fba178998dbbe4c57f2e9429">depth</a>[y]++;</div>
|
||||
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> }</div>
|
||||
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <a class="code hl_variable" href="../../dd/d1f/classdsu.html#ac0dc3e17e49fe19b159b4ea4096d7b55">setSize</a>[y] += <a class="code hl_variable" href="../../dd/d1f/classdsu.html#ac0dc3e17e49fe19b159b4ea4096d7b55">setSize</a>[x];</div>
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> }</div>
|
||||
</div>
|
||||
<div class="foldopen" id="foldopen00108" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"><a class="line" href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303"> 108</a></span> <span class="keywordtype">bool</span> <a class="code hl_function" href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303">isSame</a>(uint64_t i, uint64_t j) {</div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c">findSet</a>(i) == <a class="code hl_function" href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c">findSet</a>(j)) {</div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> }</div>
|
||||
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> }</div>
|
||||
</div>
|
||||
<div class="foldopen" id="foldopen00120" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"><a class="line" href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280"> 120</a></span> vector<uint64_t> <a class="code hl_function" href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280">getParents</a>(uint64_t i) {</div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> vector<uint64_t> ans;</div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keywordflow">while</span> (<a class="code hl_variable" href="../../dd/d1f/classdsu.html#a1ef0b0462a0dda63514f641cbb7dd8cb">p</a>[i] != i) {</div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> ans.push_back(i);</div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> i = <a class="code hl_variable" href="../../dd/d1f/classdsu.html#a1ef0b0462a0dda63514f641cbb7dd8cb">p</a>[i];</div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> }</div>
|
||||
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> ans.push_back(i);</div>
|
||||
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keywordflow">return</span> ans;</div>
|
||||
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> }</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span>};</div>
|
||||
<div class="foldopen" id="foldopen00134" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"><a class="line" href="../../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243"> 134</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243">test1</a>() {</div>
|
||||
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="comment">/* checks the parents in the resultant structures */</span></div>
|
||||
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> uint64_t n = 10; </div>
|
||||
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <a class="code hl_class" href="../../dd/d1f/classdsu.html">dsu</a> d(n + 1); </div>
|
||||
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(2, 1); </div>
|
||||
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(1, 4);</div>
|
||||
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(8, 1);</div>
|
||||
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(3, 5);</div>
|
||||
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(5, 6);</div>
|
||||
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(5, 7);</div>
|
||||
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(9, 10);</div>
|
||||
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(2, 10);</div>
|
||||
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <span class="comment">// keeping track of the changes using parent pointers</span></div>
|
||||
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> vector<uint64_t> ans = {7, 5};</div>
|
||||
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <span class="keywordflow">for</span> (uint64_t i = 0; i < ans.size(); i++) {</div>
|
||||
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> assert(d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280">getParents</a>(7).at(i) ==</div>
|
||||
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> ans[i]); <span class="comment">// makes sure algorithm works fine</span></div>
|
||||
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> }</div>
|
||||
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> cout << <span class="stringliteral">"1st test passed!"</span> << <a class="code hl_define" href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a>;</div>
|
||||
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span>}</div>
|
||||
</div>
|
||||
<div class="foldopen" id="foldopen00158" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"><a class="line" href="../../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae"> 158</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a>() {</div>
|
||||
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="comment">// checks the parents in the resultant structures</span></div>
|
||||
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> uint64_t n = 10; </div>
|
||||
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> <a class="code hl_class" href="../../dd/d1f/classdsu.html">dsu</a> d(n + 1); </div>
|
||||
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(2, 1); </div>
|
||||
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(1, 4);</div>
|
||||
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(8, 1);</div>
|
||||
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(3, 5);</div>
|
||||
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(5, 6);</div>
|
||||
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(5, 7);</div>
|
||||
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(9, 10);</div>
|
||||
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">unionSet</a>(2, 10);</div>
|
||||
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> </div>
|
||||
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> vector<uint64_t> ans = {2, 1, 10};</div>
|
||||
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keywordflow">for</span> (uint64_t i = 0; i < ans.size(); i++) {</div>
|
||||
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> assert(d.<a class="code hl_function" href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280">getParents</a>(2).at(i) ==</div>
|
||||
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> ans[i]); </div>
|
||||
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> }</div>
|
||||
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> cout << <span class="stringliteral">"2nd test passed!"</span> << <a class="code hl_define" href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a>;</div>
|
||||
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span>}</div>
|
||||
</div>
|
||||
<div class="foldopen" id="foldopen00183" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"><a class="line" href="../../df/d28/dsu__union__rank_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 183</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../df/d28/dsu__union__rank_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
|
||||
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <a class="code hl_function" href="../../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243">test1</a>(); <span class="comment">// run 1st test case</span></div>
|
||||
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <a class="code hl_function" href="../../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a>(); <span class="comment">// run 2nd test case</span></div>
|
||||
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> </div>
|
||||
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span>}</div>
|
||||
</div>
|
||||
<div class="ttc" id="aclassdsu_html"><div class="ttname"><a href="../../dd/d1f/classdsu.html">dsu</a></div><div class="ttdoc">Disjoint sets union data structure, class based representation.</div><div class="ttdef"><b>Definition</b> <a href="../../d3/dae/dsu__path__compression_8cpp_source.html#l00034">dsu_path_compression.cpp:34</a></div></div>
|
||||
<div class="ttc" id="aclassdsu_html_a126e3002a464e53cd54b07ba56482a72"><div class="ttname"><a href="../../dd/d1f/classdsu.html#a126e3002a464e53cd54b07ba56482a72">dsu::dsu</a></div><div class="ttdeci">dsu(uint64_t n)</div><div class="ttdoc">constructor for initialising all data members</div><div class="ttdef"><b>Definition</b> <a href="#l00045">dsu_union_rank.cpp:45</a></div></div>
|
||||
<div class="ttc" id="aclassdsu_html_a16851f78fe390fc1430905c83d6a2f1c"><div class="ttname"><a href="../../dd/d1f/classdsu.html#a16851f78fe390fc1430905c83d6a2f1c">dsu::findSet</a></div><div class="ttdeci">uint64_t findSet(uint64_t i)</div><div class="ttdoc">Method to find the representative of the set to which i belongs to, T(n) = O(logN)</div><div class="ttdef"><b>Definition</b> <a href="#l00062">dsu_union_rank.cpp:62</a></div></div>
|
||||
<div class="ttc" id="aclassdsu_html_a1ef0b0462a0dda63514f641cbb7dd8cb"><div class="ttname"><a href="../../dd/d1f/classdsu.html#a1ef0b0462a0dda63514f641cbb7dd8cb">dsu::p</a></div><div class="ttdeci">vector< uint64_t > p</div><div class="ttdoc">keeps track of the parent of ith element</div><div class="ttdef"><b>Definition</b> <a href="../../d3/dae/dsu__path__compression_8cpp_source.html#l00036">dsu_path_compression.cpp:36</a></div></div>
|
||||
<div class="ttc" id="aclassdsu_html_a4bf54d33fba178998dbbe4c57f2e9429"><div class="ttname"><a href="../../dd/d1f/classdsu.html#a4bf54d33fba178998dbbe4c57f2e9429">dsu::depth</a></div><div class="ttdeci">vector< uint64_t > depth</div><div class="ttdoc">tracks the depth(rank) of i in the tree</div><div class="ttdef"><b>Definition</b> <a href="../../d3/dae/dsu__path__compression_8cpp_source.html#l00037">dsu_path_compression.cpp:37</a></div></div>
|
||||
<div class="ttc" id="aclassdsu_html_a64d25c5986742f7c234ed449b2ff7303"><div class="ttname"><a href="../../dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303">dsu::isSame</a></div><div class="ttdeci">bool isSame(uint64_t i, uint64_t j)</div><div class="ttdoc">A utility function which check whether i and j belongs to same set or not.</div><div class="ttdef"><b>Definition</b> <a href="../../d3/dae/dsu__path__compression_8cpp_source.html#l00124">dsu_path_compression.cpp:124</a></div></div>
|
||||
<div class="ttc" id="aclassdsu_html_a81897528bdb53fd5e796d75d7dbc430f"><div class="ttname"><a href="../../dd/d1f/classdsu.html#a81897528bdb53fd5e796d75d7dbc430f">dsu::unionSet</a></div><div class="ttdeci">void unionSet(uint64_t i, uint64_t j)</div><div class="ttdoc">Method that combines two disjoint sets to which i and j belongs to and make a single set having a com...</div><div class="ttdef"><b>Definition</b> <a href="#l00076">dsu_union_rank.cpp:76</a></div></div>
|
||||
<div class="ttc" id="aclassdsu_html_ab8ee27083a3c2e2df80755165a2ec280"><div class="ttname"><a href="../../dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280">dsu::getParents</a></div><div class="ttdeci">vector< uint64_t > getParents(uint64_t i)</div><div class="ttdoc">Method to print all the parents of i, or the path from i to representative.</div><div class="ttdef"><b>Definition</b> <a href="#l00120">dsu_union_rank.cpp:120</a></div></div>
|
||||
<div class="ttc" id="aclassdsu_html_ac0dc3e17e49fe19b159b4ea4096d7b55"><div class="ttname"><a href="../../dd/d1f/classdsu.html#ac0dc3e17e49fe19b159b4ea4096d7b55">dsu::setSize</a></div><div class="ttdeci">vector< uint64_t > setSize</div><div class="ttdoc">size of each chunk(set)</div><div class="ttdef"><b>Definition</b> <a href="../../d3/dae/dsu__path__compression_8cpp_source.html#l00038">dsu_path_compression.cpp:38</a></div></div>
|
||||
<div class="ttc" id="adsu__union__rank_8cpp_html_a45d94ead4cf4e1ff9f87c38bc99f59ae"><div class="ttname"><a href="../../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a></div><div class="ttdeci">static void test2()</div><div class="ttdoc">Self-implementations, 2nd test.</div><div class="ttdef"><b>Definition</b> <a href="#l00158">dsu_union_rank.cpp:158</a></div></div>
|
||||
<div class="ttc" id="adsu__union__rank_8cpp_html_ae66f6b31b5ad750f1fe042a706a4e3d4"><div class="ttname"><a href="../../df/d28/dsu__union__rank_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a></div><div class="ttdeci">int main()</div><div class="ttdoc">Main function.</div><div class="ttdef"><b>Definition</b> <a href="#l00183">dsu_union_rank.cpp:183</a></div></div>
|
||||
<div class="ttc" id="adsu__union__rank_8cpp_html_ae7880ce913f3058a35ff106d5be9e243"><div class="ttname"><a href="../../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243">test1</a></div><div class="ttdeci">static void test1()</div><div class="ttdoc">Self-implementations, 1st test.</div><div class="ttdef"><b>Definition</b> <a href="#l00134">dsu_union_rank.cpp:134</a></div></div>
|
||||
<div class="ttc" id="amatrix__exponentiation_8cpp_html_a600eaf353befc174637855795f12d258"><div class="ttname"><a href="../../d7/d35/matrix__exponentiation_8cpp.html#a600eaf353befc174637855795f12d258">endl</a></div><div class="ttdeci">#define endl</div><div class="ttdef"><b>Definition</b> <a href="../../d7/d35/matrix__exponentiation_8cpp_source.html#l00036">matrix_exponentiation.cpp:36</a></div></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_2e746e9d06bf2d8ff842208bcc6ebcfc.html">data_structures</a></li><li class="navelem"><a class="el" href="../../df/d28/dsu__union__rank_8cpp.html">dsu_union_rank.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.12.0 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user