mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-25 06:12:11 +08:00
Documentation for f821fae698
This commit is contained in:
302
df/d28/dsu__union__rank_8cpp.html
Normal file
302
df/d28/dsu__union__rank_8cpp.html
Normal file
@@ -0,0 +1,302 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: data_structures/dsu_union_rank.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../jquery.js"></script>
|
||||
<script type="text/javascript" src="../../dynsections.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../resize.js"></script>
|
||||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||||
<script type="text/javascript" src="../../navtree.js"></script>
|
||||
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @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');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
<div id="nav-tree">
|
||||
<div id="nav-tree-contents">
|
||||
<div id="nav-sync" class="sync"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="splitbar" style="-moz-user-select:none;"
|
||||
class="ui-resizable-handle">
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('df/d28/dsu__union__rank_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#nested-classes">Classes</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle"><div class="title">dsu_union_rank.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p><a href="https://en.wikipedia.org/wiki/Disjoint-set-data_structure" target="_blank">DSU (Disjoint sets)</a>
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <cassert></code><br />
|
||||
<code>#include <iostream></code><br />
|
||||
<code>#include <vector></code><br />
|
||||
</div><div class="textblock"><div class="dynheader">
|
||||
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="258" height="127"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a 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>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Disjoint sets union data structure, class based representation. <a href="../../dd/d1f/classdsu.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:ae7880ce913f3058a35ff106d5be9e243"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243">test1</a> ()</td></tr>
|
||||
<tr class="memdesc:ae7880ce913f3058a35ff106d5be9e243"><td class="mdescLeft"> </td><td class="mdescRight">Self-implementations, 1st test. <a href="../../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243">More...</a><br /></td></tr>
|
||||
<tr class="separator:ae7880ce913f3058a35ff106d5be9e243"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a45d94ead4cf4e1ff9f87c38bc99f59ae"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a> ()</td></tr>
|
||||
<tr class="memdesc:a45d94ead4cf4e1ff9f87c38bc99f59ae"><td class="mdescLeft"> </td><td class="mdescRight">Self-implementations, 2nd test. <a href="../../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">More...</a><br /></td></tr>
|
||||
<tr class="separator:a45d94ead4cf4e1ff9f87c38bc99f59ae"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d28/dsu__union__rank_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
|
||||
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft"> </td><td class="mdescRight">Main function. <a href="../../df/d28/dsu__union__rank_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">More...</a><br /></td></tr>
|
||||
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p ><a href="https://en.wikipedia.org/wiki/Disjoint-set-data_structure" target="_blank">DSU (Disjoint sets)</a> </p>
|
||||
<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>
|
||||
</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>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">int main </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void </td>
|
||||
<td class="paramname"></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Main function. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||||
<div class="fragment"><div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> {</div>
|
||||
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</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="l00184" name="l00184"></a><span class="lineno"> 184</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="l00185" name="l00185"></a><span class="lineno"> 185</span> </div>
|
||||
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span>}</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> dsu_union_rank.cpp:157</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> dsu_union_rank.cpp:133</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="608" height="208"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae7880ce913f3058a35ff106d5be9e243" name="ae7880ce913f3058a35ff106d5be9e243"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae7880ce913f3058a35ff106d5be9e243">◆ </a></span>test1()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">static void test1 </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Self-implementations, 1st test. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
<p >< number of elements</p>
|
||||
<p >< object of class disjoint sets</p>
|
||||
<p >< performs union operation on 1 and 2</p>
|
||||
<div class="fragment"><div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> {</div>
|
||||
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <span class="comment">/* checks the parents in the resultant structures */</span></div>
|
||||
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> uint64_t n = 10; <span class="comment">///< number of elements</span></div>
|
||||
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</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"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> d.unionSet(2, 1); <span class="comment">///< performs union operation on 1 and 2</span></div>
|
||||
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> d.unionSet(1, 4);</div>
|
||||
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> d.unionSet(8, 1);</div>
|
||||
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> d.unionSet(3, 5);</div>
|
||||
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> d.unionSet(5, 6);</div>
|
||||
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> d.unionSet(5, 7);</div>
|
||||
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> d.unionSet(9, 10);</div>
|
||||
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> d.unionSet(2, 10);</div>
|
||||
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> <span class="comment">// keeping track of the changes using parent pointers</span></div>
|
||||
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">vector<uint64_t></a> <a class="code hl_function" href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa">ans</a> = {7, 5};</div>
|
||||
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <span class="keywordflow">for</span> (uint64_t i = 0; i < <a class="code hl_function" href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa">ans</a>.size(); i++) {</div>
|
||||
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> assert(d.getParents(7).at(i) ==</div>
|
||||
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <a class="code hl_function" href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa">ans</a>[i]); <span class="comment">// makes sure algorithm works fine</span></div>
|
||||
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> }</div>
|
||||
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</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"><a id="l00152" name="l00152"></a><span class="lineno"> 152</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:33</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="amatrix__exponentiation_8cpp_html_ad8389ed58fd0ec66df248014775ad1fa"><div class="ttname"><a href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa">ans</a></div><div class="ttdeci">ll ans(ll n)</div><div class="ttdef"><b>Definition:</b> matrix_exponentiation.cpp:91</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="510" height="190"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a45d94ead4cf4e1ff9f87c38bc99f59ae" name="a45d94ead4cf4e1ff9f87c38bc99f59ae"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a45d94ead4cf4e1ff9f87c38bc99f59ae">◆ </a></span>test2()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="mlabels">
|
||||
<tr>
|
||||
<td class="mlabels-left">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">static void test2 </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Self-implementations, 2nd test. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
<p >< number of elements</p>
|
||||
<p >< object of class disjoint sets</p>
|
||||
<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>
|
||||
<div class="fragment"><div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> {</div>
|
||||
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <span class="comment">// checks the parents in the resultant structures</span></div>
|
||||
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> uint64_t n = 10; <span class="comment">///< number of elements</span></div>
|
||||
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</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"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> d.unionSet(2, 1); <span class="comment">/// performs union operation on 1 and 2</span></div>
|
||||
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> d.unionSet(1, 4);</div>
|
||||
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> d.unionSet(8, 1);</div>
|
||||
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> d.unionSet(3, 5);</div>
|
||||
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> d.unionSet(5, 6);</div>
|
||||
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> d.unionSet(5, 7);</div>
|
||||
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> d.unionSet(9, 10);</div>
|
||||
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> d.unionSet(2, 10);</div>
|
||||
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span><span class="comment"></span> </div>
|
||||
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span><span class="comment"> /// keeping track of the changes using parent pointers</span></div>
|
||||
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</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> <a class="code hl_function" href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa">ans</a> = {2, 1, 10};</div>
|
||||
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="keywordflow">for</span> (uint64_t i = 0; i < <a class="code hl_function" href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa">ans</a>.size(); i++) {</div>
|
||||
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> assert(d.getParents(2).at(i) ==</div>
|
||||
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> <a class="code hl_function" href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa">ans</a>[i]); <span class="comment">/// makes sure algorithm works fine</span></div>
|
||||
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> }</div>
|
||||
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</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"><a id="l00177" name="l00177"></a><span class="lineno"> 177</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="510" height="190"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- 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.9.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
7
df/d28/dsu__union__rank_8cpp.js
Normal file
7
df/d28/dsu__union__rank_8cpp.js
Normal file
@@ -0,0 +1,7 @@
|
||||
var dsu__union__rank_8cpp =
|
||||
[
|
||||
[ "dsu", "dd/d1f/classdsu.html", "dd/d1f/classdsu" ],
|
||||
[ "main", "df/d28/dsu__union__rank_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ],
|
||||
[ "test1", "df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243", null ],
|
||||
[ "test2", "df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae", null ]
|
||||
];
|
||||
@@ -0,0 +1,9 @@
|
||||
<map id="test2" name="test2">
|
||||
<area shape="rect" id="node1" title="Self-implementations, 2nd test." alt="" coords="5,56,56,83"/>
|
||||
<area shape="rect" id="node2" href="$d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa" title=" " alt="" coords="294,5,338,32"/>
|
||||
<area shape="rect" id="node3" 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,56,220,83"/>
|
||||
<area shape="rect" id="node4" 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,107,214,133"/>
|
||||
<area shape="rect" id="node5" 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="412,81,504,108"/>
|
||||
<area shape="rect" id="node6" href="$dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" title="A utility function which check whether i and j belongs to same set or not." alt="" coords="268,107,364,133"/>
|
||||
<area shape="rect" id="node7" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/swap.html#" title=" " alt="" coords="277,157,355,184"/>
|
||||
</map>
|
||||
@@ -0,0 +1 @@
|
||||
413d5a9409029480fc4dd4ab917bdc62
|
||||
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 2.49.2 (20211016.1639)
|
||||
-->
|
||||
<!-- Title: test2 Pages: 1 -->
|
||||
<svg width="382pt" height="142pt"
|
||||
viewBox="0.00 0.00 382.00 142.00" 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 138)">
|
||||
<title>test2</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-138 378,-138 378,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title="Self-implementations, 2nd test.">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="0,-76.5 0,-95.5 38,-95.5 38,-76.5 0,-76.5"/>
|
||||
<text text-anchor="middle" x="19" y="-83.5" font-family="Helvetica,sans-Serif" font-size="10.00">test2</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="node2" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_node2"><a xlink:href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa" target="_top" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="216.5,-114.5 216.5,-133.5 249.5,-133.5 249.5,-114.5 216.5,-114.5"/>
|
||||
<text text-anchor="middle" x="233" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">ans</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.2,-93.52C48.53,-97.51 61.8,-102.16 74,-105 119.73,-115.66 174.38,-120.54 205.95,-122.62"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="205.91,-126.12 216.1,-123.24 206.34,-119.13 205.91,-126.12"/>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="node3" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_node3"><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="black" points="74,-76.5 74,-95.5 161,-95.5 161,-76.5 74,-76.5"/>
|
||||
<text text-anchor="middle" x="117.5" y="-83.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::getParents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.15,-86C45.45,-86 54.28,-86 63.34,-86"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="63.6,-89.5 73.6,-86 63.6,-82.5 63.6,-89.5"/>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="node4" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_node4"><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="black" points="78.5,-38.5 78.5,-57.5 156.5,-57.5 156.5,-38.5 78.5,-38.5"/>
|
||||
<text text-anchor="middle" x="117.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::unionSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node4 -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>Node1->Node4</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.15,-78.85C50.69,-73.91 67.75,-67.2 82.74,-61.29"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="84.21,-64.48 92.23,-57.56 81.65,-57.96 84.21,-64.48"/>
|
||||
</g>
|
||||
<!-- Node3->Node2 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>Node3->Node2</title>
|
||||
<path fill="none" stroke="midnightblue" d="M147.14,-95.59C165.48,-101.73 189.05,-109.62 206.69,-115.53"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="205.72,-118.89 216.32,-118.75 207.94,-112.25 205.72,-118.89"/>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="node5" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_node5"><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="black" points="305,-57.5 305,-76.5 374,-76.5 374,-57.5 305,-57.5"/>
|
||||
<text text-anchor="middle" x="339.5" y="-64.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::findSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node5 -->
|
||||
<g id="edge5" class="edge">
|
||||
<title>Node4->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M150.27,-57.51C164.43,-61.27 181.41,-65.14 197,-67 229.55,-70.88 266.62,-70.72 294.65,-69.67"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="295.08,-73.15 304.92,-69.23 294.78,-66.16 295.08,-73.15"/>
|
||||
</g>
|
||||
<!-- Node6 -->
|
||||
<g id="node6" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_node6"><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="black" points="197,-38.5 197,-57.5 269,-57.5 269,-38.5 197,-38.5"/>
|
||||
<text text-anchor="middle" x="233" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::isSame</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node6 -->
|
||||
<g id="edge7" class="edge">
|
||||
<title>Node4->Node6</title>
|
||||
<path fill="none" stroke="midnightblue" d="M156.61,-48C166.26,-48 176.73,-48 186.7,-48"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="186.86,-51.5 196.86,-48 186.86,-44.5 186.86,-51.5"/>
|
||||
</g>
|
||||
<!-- Node7 -->
|
||||
<g id="node7" class="node">
|
||||
<title>Node7</title>
|
||||
<g id="a_node7"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/algorithm/swap.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="203.5,-0.5 203.5,-19.5 262.5,-19.5 262.5,-0.5 203.5,-0.5"/>
|
||||
<text text-anchor="middle" x="233" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::swap</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node7 -->
|
||||
<g id="edge9" class="edge">
|
||||
<title>Node4->Node7</title>
|
||||
<path fill="none" stroke="midnightblue" d="M147.14,-38.41C161.25,-33.69 178.47,-27.92 193.7,-22.82"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="195,-26.08 203.37,-19.59 192.77,-19.44 195,-26.08"/>
|
||||
</g>
|
||||
<!-- Node5->Node5 -->
|
||||
<g id="edge6" class="edge">
|
||||
<title>Node5->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M323.16,-76.76C315.21,-85.57 320.66,-95 339.5,-95 351.27,-95 357.82,-91.31 359.13,-86.4"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="362.38,-85.09 355.84,-76.76 355.76,-87.35 362.38,-85.09"/>
|
||||
</g>
|
||||
<!-- Node6->Node5 -->
|
||||
<g id="edge8" class="edge">
|
||||
<title>Node6->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M269.09,-54.38C277.36,-55.88 286.27,-57.5 294.86,-59.07"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="294.28,-62.52 304.74,-60.86 295.53,-55.63 294.28,-62.52"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.6 KiB |
@@ -0,0 +1,11 @@
|
||||
<map id="main" name="main">
|
||||
<area shape="rect" id="node1" title="Main function." alt="" coords="5,49,56,75"/>
|
||||
<area shape="rect" id="node2" href="$df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243" title="Self-implementations, 1st test." alt="" coords="104,74,155,101"/>
|
||||
<area shape="rect" id="node9" href="$df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae" title="Self-implementations, 2nd test." alt="" coords="104,23,155,50"/>
|
||||
<area shape="rect" id="node3" href="$d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa" title=" " alt="" coords="393,23,437,50"/>
|
||||
<area shape="rect" id="node4" href="$dd/d1f/classdsu.html#ab8ee27083a3c2e2df80755165a2ec280" title="Method to print all the parents of i, or the path from i to representative." alt="" coords="203,23,319,50"/>
|
||||
<area shape="rect" id="node5" 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="209,125,313,151"/>
|
||||
<area shape="rect" id="node6" 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="511,99,603,126"/>
|
||||
<area shape="rect" id="node7" href="$dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" title="A utility function which check whether i and j belongs to same set or not." alt="" coords="367,125,463,151"/>
|
||||
<area shape="rect" id="node8" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/swap.html#" title=" " alt="" coords="375,175,454,202"/>
|
||||
</map>
|
||||
@@ -0,0 +1 @@
|
||||
0a7e08d906379ef71155e6daf0c91734
|
||||
@@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 2.49.2 (20211016.1639)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="456pt" height="156pt"
|
||||
viewBox="0.00 0.00 456.00 155.52" 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 151.52)">
|
||||
<title>main</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-151.52 452,-151.52 452,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title="Main function.">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="0,-95.5 0,-114.5 38,-114.5 38,-95.5 0,-95.5"/>
|
||||
<text text-anchor="middle" x="19" y="-102.5" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="node2" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_node2"><a xlink:href="../../df/d28/dsu__union__rank_8cpp.html#ae7880ce913f3058a35ff106d5be9e243" target="_top" xlink:title="Self-implementations, 1st test.">
|
||||
<polygon fill="white" stroke="black" points="74,-76.5 74,-95.5 112,-95.5 112,-76.5 74,-76.5"/>
|
||||
<text text-anchor="middle" x="93" y="-83.5" font-family="Helvetica,sans-Serif" font-size="10.00">test1</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.17,-100.21C45.95,-98.15 55.23,-95.7 63.87,-93.42"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="64.81,-96.79 73.59,-90.86 63.02,-90.03 64.81,-96.79"/>
|
||||
</g>
|
||||
<!-- Node9 -->
|
||||
<g id="node9" class="node">
|
||||
<title>Node9</title>
|
||||
<g id="a_node9"><a xlink:href="../../df/d28/dsu__union__rank_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae" target="_top" xlink:title="Self-implementations, 2nd test.">
|
||||
<polygon fill="white" stroke="black" points="74,-114.5 74,-133.5 112,-133.5 112,-114.5 74,-114.5"/>
|
||||
<text text-anchor="middle" x="93" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">test2</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node9 -->
|
||||
<g id="edge11" class="edge">
|
||||
<title>Node1->Node9</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.17,-109.79C45.95,-111.85 55.23,-114.3 63.87,-116.58"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="63.02,-119.97 73.59,-119.14 64.81,-113.21 63.02,-119.97"/>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="node3" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_node3"><a xlink:href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa" target="_top" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="290.5,-114.5 290.5,-133.5 323.5,-133.5 323.5,-114.5 290.5,-114.5"/>
|
||||
<text text-anchor="middle" x="307" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">ans</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node3 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>Node2->Node3</title>
|
||||
<path fill="none" stroke="midnightblue" d="M112.38,-87.72C139.41,-90.42 191.41,-96.27 235,-105 250.2,-108.05 266.97,-112.48 280.39,-116.3"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="279.76,-119.76 290.34,-119.19 281.72,-113.04 279.76,-119.76"/>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="node4" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_node4"><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="black" points="148,-114.5 148,-133.5 235,-133.5 235,-114.5 148,-114.5"/>
|
||||
<text text-anchor="middle" x="191.5" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::getParents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node4 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>Node2->Node4</title>
|
||||
<path fill="none" stroke="midnightblue" d="M112.15,-93.15C124.69,-98.09 141.75,-104.8 156.74,-110.71"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="155.65,-114.04 166.23,-114.44 158.21,-107.52 155.65,-114.04"/>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="node5" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_node5"><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="black" points="152.5,-38.5 152.5,-57.5 230.5,-57.5 230.5,-38.5 152.5,-38.5"/>
|
||||
<text text-anchor="middle" x="191.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::unionSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node5 -->
|
||||
<g id="edge5" class="edge">
|
||||
<title>Node2->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M112.15,-78.85C124.69,-73.91 141.75,-67.2 156.74,-61.29"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="158.21,-64.48 166.23,-57.56 155.65,-57.96 158.21,-64.48"/>
|
||||
</g>
|
||||
<!-- Node4->Node3 -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>Node4->Node3</title>
|
||||
<path fill="none" stroke="midnightblue" d="M235.09,-124C250.22,-124 266.79,-124 280.11,-124"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="280.42,-127.5 290.42,-124 280.42,-120.5 280.42,-127.5"/>
|
||||
</g>
|
||||
<!-- Node6 -->
|
||||
<g id="node6" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_node6"><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="black" points="379,-57.5 379,-76.5 448,-76.5 448,-57.5 379,-57.5"/>
|
||||
<text text-anchor="middle" x="413.5" y="-64.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::findSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node6 -->
|
||||
<g id="edge6" class="edge">
|
||||
<title>Node5->Node6</title>
|
||||
<path fill="none" stroke="midnightblue" d="M224.27,-57.51C238.43,-61.27 255.41,-65.14 271,-67 303.55,-70.88 340.62,-70.72 368.65,-69.67"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="369.08,-73.15 378.92,-69.23 368.78,-66.16 369.08,-73.15"/>
|
||||
</g>
|
||||
<!-- Node7 -->
|
||||
<g id="node7" class="node">
|
||||
<title>Node7</title>
|
||||
<g id="a_node7"><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="black" points="271,-38.5 271,-57.5 343,-57.5 343,-38.5 271,-38.5"/>
|
||||
<text text-anchor="middle" x="307" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::isSame</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node7 -->
|
||||
<g id="edge8" class="edge">
|
||||
<title>Node5->Node7</title>
|
||||
<path fill="none" stroke="midnightblue" d="M230.61,-48C240.26,-48 250.73,-48 260.7,-48"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="260.86,-51.5 270.86,-48 260.86,-44.5 260.86,-51.5"/>
|
||||
</g>
|
||||
<!-- Node8 -->
|
||||
<g id="node8" class="node">
|
||||
<title>Node8</title>
|
||||
<g id="a_node8"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/algorithm/swap.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="277.5,-0.5 277.5,-19.5 336.5,-19.5 336.5,-0.5 277.5,-0.5"/>
|
||||
<text text-anchor="middle" x="307" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::swap</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node5->Node8 -->
|
||||
<g id="edge10" class="edge">
|
||||
<title>Node5->Node8</title>
|
||||
<path fill="none" stroke="midnightblue" d="M221.14,-38.41C235.25,-33.69 252.47,-27.92 267.7,-22.82"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="269,-26.08 277.37,-19.59 266.77,-19.44 269,-26.08"/>
|
||||
</g>
|
||||
<!-- Node6->Node6 -->
|
||||
<g id="edge7" class="edge">
|
||||
<title>Node6->Node6</title>
|
||||
<path fill="none" stroke="midnightblue" d="M397.16,-76.76C389.21,-85.57 394.66,-95 413.5,-95 425.27,-95 431.82,-91.31 433.13,-86.4"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="436.38,-85.09 429.84,-76.76 429.76,-87.35 436.38,-85.09"/>
|
||||
</g>
|
||||
<!-- Node7->Node6 -->
|
||||
<g id="edge9" class="edge">
|
||||
<title>Node7->Node6</title>
|
||||
<path fill="none" stroke="midnightblue" d="M343.09,-54.38C351.36,-55.88 360.27,-57.5 368.86,-59.07"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="368.28,-62.52 378.74,-60.86 369.53,-55.63 368.28,-62.52"/>
|
||||
</g>
|
||||
<!-- Node9->Node3 -->
|
||||
<g id="edge12" class="edge">
|
||||
<title>Node9->Node3</title>
|
||||
<path fill="none" stroke="midnightblue" d="M112.08,-132.09C122.38,-136.26 135.66,-140.89 148,-143 186.11,-149.51 196.66,-148.04 235,-143 250.37,-140.98 267.15,-136.6 280.53,-132.55"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="281.96,-135.77 290.45,-129.43 279.86,-129.09 281.96,-135.77"/>
|
||||
</g>
|
||||
<!-- Node9->Node4 -->
|
||||
<g id="edge13" class="edge">
|
||||
<title>Node9->Node4</title>
|
||||
<path fill="none" stroke="midnightblue" d="M112.15,-124C119.45,-124 128.28,-124 137.34,-124"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="137.6,-127.5 147.6,-124 137.6,-120.5 137.6,-127.5"/>
|
||||
</g>
|
||||
<!-- Node9->Node5 -->
|
||||
<g id="edge14" class="edge">
|
||||
<title>Node9->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M106.22,-114.37C122.39,-101.64 151.1,-79.03 170.47,-63.78"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="172.69,-66.48 178.38,-57.55 168.36,-60.98 172.69,-66.48"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.1 KiB |
@@ -0,0 +1,9 @@
|
||||
<map id="test1" name="test1">
|
||||
<area shape="rect" id="node1" title="Self-implementations, 1st test." alt="" coords="5,56,56,83"/>
|
||||
<area shape="rect" id="node2" href="$d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa" title=" " alt="" coords="294,5,338,32"/>
|
||||
<area shape="rect" id="node3" 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,56,220,83"/>
|
||||
<area shape="rect" id="node4" 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,107,214,133"/>
|
||||
<area shape="rect" id="node5" 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="412,81,504,108"/>
|
||||
<area shape="rect" id="node6" href="$dd/d1f/classdsu.html#a64d25c5986742f7c234ed449b2ff7303" title="A utility function which check whether i and j belongs to same set or not." alt="" coords="268,107,364,133"/>
|
||||
<area shape="rect" id="node7" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/swap.html#" title=" " alt="" coords="277,157,355,184"/>
|
||||
</map>
|
||||
@@ -0,0 +1 @@
|
||||
05fd810df88836bd72af8e5abb419c5c
|
||||
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 2.49.2 (20211016.1639)
|
||||
-->
|
||||
<!-- Title: test1 Pages: 1 -->
|
||||
<svg width="382pt" height="142pt"
|
||||
viewBox="0.00 0.00 382.00 142.00" 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 138)">
|
||||
<title>test1</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-138 378,-138 378,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title="Self-implementations, 1st test.">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="0,-76.5 0,-95.5 38,-95.5 38,-76.5 0,-76.5"/>
|
||||
<text text-anchor="middle" x="19" y="-83.5" font-family="Helvetica,sans-Serif" font-size="10.00">test1</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="node2" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_node2"><a xlink:href="../../d7/d35/matrix__exponentiation_8cpp.html#ad8389ed58fd0ec66df248014775ad1fa" target="_top" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="216.5,-114.5 216.5,-133.5 249.5,-133.5 249.5,-114.5 216.5,-114.5"/>
|
||||
<text text-anchor="middle" x="233" y="-121.5" font-family="Helvetica,sans-Serif" font-size="10.00">ans</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.2,-93.52C48.53,-97.51 61.8,-102.16 74,-105 119.73,-115.66 174.38,-120.54 205.95,-122.62"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="205.91,-126.12 216.1,-123.24 206.34,-119.13 205.91,-126.12"/>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="node3" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_node3"><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="black" points="74,-76.5 74,-95.5 161,-95.5 161,-76.5 74,-76.5"/>
|
||||
<text text-anchor="middle" x="117.5" y="-83.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::getParents</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.15,-86C45.45,-86 54.28,-86 63.34,-86"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="63.6,-89.5 73.6,-86 63.6,-82.5 63.6,-89.5"/>
|
||||
</g>
|
||||
<!-- Node4 -->
|
||||
<g id="node4" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_node4"><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="black" points="78.5,-38.5 78.5,-57.5 156.5,-57.5 156.5,-38.5 78.5,-38.5"/>
|
||||
<text text-anchor="middle" x="117.5" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::unionSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node4 -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>Node1->Node4</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.15,-78.85C50.69,-73.91 67.75,-67.2 82.74,-61.29"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="84.21,-64.48 92.23,-57.56 81.65,-57.96 84.21,-64.48"/>
|
||||
</g>
|
||||
<!-- Node3->Node2 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>Node3->Node2</title>
|
||||
<path fill="none" stroke="midnightblue" d="M147.14,-95.59C165.48,-101.73 189.05,-109.62 206.69,-115.53"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="205.72,-118.89 216.32,-118.75 207.94,-112.25 205.72,-118.89"/>
|
||||
</g>
|
||||
<!-- Node5 -->
|
||||
<g id="node5" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_node5"><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="black" points="305,-57.5 305,-76.5 374,-76.5 374,-57.5 305,-57.5"/>
|
||||
<text text-anchor="middle" x="339.5" y="-64.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::findSet</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node5 -->
|
||||
<g id="edge5" class="edge">
|
||||
<title>Node4->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M150.27,-57.51C164.43,-61.27 181.41,-65.14 197,-67 229.55,-70.88 266.62,-70.72 294.65,-69.67"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="295.08,-73.15 304.92,-69.23 294.78,-66.16 295.08,-73.15"/>
|
||||
</g>
|
||||
<!-- Node6 -->
|
||||
<g id="node6" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_node6"><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="black" points="197,-38.5 197,-57.5 269,-57.5 269,-38.5 197,-38.5"/>
|
||||
<text text-anchor="middle" x="233" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">dsu::isSame</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node6 -->
|
||||
<g id="edge7" class="edge">
|
||||
<title>Node4->Node6</title>
|
||||
<path fill="none" stroke="midnightblue" d="M156.61,-48C166.26,-48 176.73,-48 186.7,-48"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="186.86,-51.5 196.86,-48 186.86,-44.5 186.86,-51.5"/>
|
||||
</g>
|
||||
<!-- Node7 -->
|
||||
<g id="node7" class="node">
|
||||
<title>Node7</title>
|
||||
<g id="a_node7"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/algorithm/swap.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="203.5,-0.5 203.5,-19.5 262.5,-19.5 262.5,-0.5 203.5,-0.5"/>
|
||||
<text text-anchor="middle" x="233" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::swap</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node4->Node7 -->
|
||||
<g id="edge9" class="edge">
|
||||
<title>Node4->Node7</title>
|
||||
<path fill="none" stroke="midnightblue" d="M147.14,-38.41C161.25,-33.69 178.47,-27.92 193.7,-22.82"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="195,-26.08 203.37,-19.59 192.77,-19.44 195,-26.08"/>
|
||||
</g>
|
||||
<!-- Node5->Node5 -->
|
||||
<g id="edge6" class="edge">
|
||||
<title>Node5->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M323.16,-76.76C315.21,-85.57 320.66,-95 339.5,-95 351.27,-95 357.82,-91.31 359.13,-86.4"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="362.38,-85.09 355.84,-76.76 355.76,-87.35 362.38,-85.09"/>
|
||||
</g>
|
||||
<!-- Node6->Node5 -->
|
||||
<g id="edge8" class="edge">
|
||||
<title>Node6->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M269.09,-54.38C277.36,-55.88 286.27,-57.5 294.86,-59.07"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="294.28,-62.52 304.74,-60.86 295.53,-55.63 294.28,-62.52"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.6 KiB |
Reference in New Issue
Block a user