mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-21 12:23:13 +08:00
315 lines
42 KiB
HTML
315 lines
42 KiB
HTML
<!-- 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.13.2"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>TheAlgorithms/C++: graph/lowest_common_ancestor.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.13.2 -->
|
|
<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('de/dde/lowest__common__ancestor_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">lowest_common_ancestor.cpp</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="../../de/dde/lowest__common__ancestor_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="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
|
|
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span><span class="preprocessor">#include <cassert></span></div>
|
|
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span><span class="preprocessor">#include <iostream></span></div>
|
|
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span><span class="preprocessor">#include <queue></span></div>
|
|
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span><span class="preprocessor">#include <utility></span></div>
|
|
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span><span class="preprocessor">#include <vector></span></div>
|
|
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span></div>
|
|
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a> {</div>
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span><span class="keyword">class </span><a class="code hl_class" href="../../dc/d61/classgraph_1_1_graph.html">Graph</a> {</div>
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keyword">public</span>:</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="../../dc/d61/classgraph_1_1_graph.html#a8839fa14bff19d2deab4a618447c13e5"> 62</a></span> <a class="code hl_function" href="../../dc/d61/classgraph_1_1_graph.html#a8839fa14bff19d2deab4a618447c13e5">Graph</a>(<span class="keywordtype">size_t</span> N, <span class="keyword">const</span> std::vector<std::pair<int, int> > &undirected_edges) {</div>
|
|
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <a class="code hl_variable" href="../../dc/d61/classgraph_1_1_graph.html#a59940c462861f2fcf4951d1b6c084e6a">neighbors</a>.resize(N);</div>
|
|
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> &edge : undirected_edges) {</div>
|
|
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <a class="code hl_variable" href="../../dc/d61/classgraph_1_1_graph.html#a59940c462861f2fcf4951d1b6c084e6a">neighbors</a>[edge.first].push_back(edge.second);</div>
|
|
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <a class="code hl_variable" href="../../dc/d61/classgraph_1_1_graph.html#a59940c462861f2fcf4951d1b6c084e6a">neighbors</a>[edge.second].push_back(edge.first);</div>
|
|
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> }</div>
|
|
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span></div>
|
|
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"><a class="line" href="../../dc/d61/classgraph_1_1_graph.html#a8930d1470d132b19e430d1c71f94c904"> 74</a></span> <span class="keywordtype">int</span> <a class="code hl_function" href="../../dc/d61/classgraph_1_1_graph.html#a8930d1470d132b19e430d1c71f94c904">number_of_vertices</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="../../dc/d61/classgraph_1_1_graph.html#a59940c462861f2fcf4951d1b6c084e6a">neighbors</a>.size(); }</div>
|
|
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span></div>
|
|
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"><a class="line" href="../../dc/d61/classgraph_1_1_graph.html#a59940c462861f2fcf4951d1b6c084e6a"> 77</a></span> std::vector<std::vector<int> > <a class="code hl_variable" href="../../dc/d61/classgraph_1_1_graph.html#a59940c462861f2fcf4951d1b6c084e6a">neighbors</a>;</div>
|
|
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span>};</div>
|
|
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span></div>
|
|
<div class="foldopen" id="foldopen00084" data-start="{" data-end="};">
|
|
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"><a class="line" href="../../d0/d58/classgraph_1_1_rooted_tree.html"> 84</a></span><span class="keyword">class </span><a class="code hl_function" href="../../d0/d58/classgraph_1_1_rooted_tree.html#aacdeecac857623e9fbfe92590f3c504d">RootedTree</a> : <span class="keyword">public</span> Graph {</div>
|
|
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keyword">public</span>:</div>
|
|
<div class="foldopen" id="foldopen00093" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"><a class="line" href="../../d0/d58/classgraph_1_1_rooted_tree.html#aacdeecac857623e9fbfe92590f3c504d"> 93</a></span> <a class="code hl_function" href="../../d0/d58/classgraph_1_1_rooted_tree.html#aacdeecac857623e9fbfe92590f3c504d">RootedTree</a>(<span class="keyword">const</span> std::vector<std::pair<int, int> > &undirected_edges,</div>
|
|
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="keywordtype">int</span> root_)</div>
|
|
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> : Graph(undirected_edges.size() + 1, undirected_edges), <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ab22a97bf6209a085fc2d788c3c0dacbe">root</a>(root_) {</div>
|
|
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <a class="code hl_function" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ae6928f3ebd491541e9570e746b877c1e">populate_parents</a>();</div>
|
|
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span></div>
|
|
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"><a class="line" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a3831583a91914988897a4cc8748fda43"> 104</a></span> std::vector<int> <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a3831583a91914988897a4cc8748fda43">parent</a>;</div>
|
|
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"><a class="line" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a2ee3ad1161ac2532da30c3e22c265ad3"> 106</a></span> std::vector<int> <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a2ee3ad1161ac2532da30c3e22c265ad3">level</a>;</div>
|
|
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"><a class="line" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ab22a97bf6209a085fc2d788c3c0dacbe"> 108</a></span> <span class="keywordtype">int</span> <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ab22a97bf6209a085fc2d788c3c0dacbe">root</a>;</div>
|
|
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> </div>
|
|
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <span class="keyword">protected</span>:</div>
|
|
<div class="foldopen" id="foldopen00117" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"><a class="line" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ae6928f3ebd491541e9570e746b877c1e"> 117</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ae6928f3ebd491541e9570e746b877c1e">populate_parents</a>() {</div>
|
|
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="comment">// Initialize the vector with -1 which indicates the vertex</span></div>
|
|
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="comment">// wasn't yet visited.</span></div>
|
|
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a3831583a91914988897a4cc8748fda43">parent</a> = std::vector<int>(<a class="code hl_function" href="../../dc/d61/classgraph_1_1_graph.html#a8930d1470d132b19e430d1c71f94c904">number_of_vertices</a>(), -1);</div>
|
|
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a2ee3ad1161ac2532da30c3e22c265ad3">level</a> = std::vector<int>(<a class="code hl_function" href="../../dc/d61/classgraph_1_1_graph.html#a8930d1470d132b19e430d1c71f94c904">number_of_vertices</a>());</div>
|
|
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a3831583a91914988897a4cc8748fda43">parent</a>[<a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ab22a97bf6209a085fc2d788c3c0dacbe">root</a>] = <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ab22a97bf6209a085fc2d788c3c0dacbe">root</a>;</div>
|
|
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a2ee3ad1161ac2532da30c3e22c265ad3">level</a>[<a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ab22a97bf6209a085fc2d788c3c0dacbe">root</a>] = 0;</div>
|
|
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> std::queue<int> queue_of_vertices;</div>
|
|
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> queue_of_vertices.push(<a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#ab22a97bf6209a085fc2d788c3c0dacbe">root</a>);</div>
|
|
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordflow">while</span> (!queue_of_vertices.empty()) {</div>
|
|
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keywordtype">int</span> vertex = queue_of_vertices.front();</div>
|
|
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> queue_of_vertices.pop();</div>
|
|
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> neighbor : <a class="code hl_variable" href="../../dc/d61/classgraph_1_1_graph.html#a59940c462861f2fcf4951d1b6c084e6a">neighbors</a>[vertex]) {</div>
|
|
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="comment">// As long as the vertex was not yet visited.</span></div>
|
|
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a3831583a91914988897a4cc8748fda43">parent</a>[neighbor] == -1) {</div>
|
|
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a3831583a91914988897a4cc8748fda43">parent</a>[neighbor] = vertex;</div>
|
|
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a2ee3ad1161ac2532da30c3e22c265ad3">level</a>[neighbor] = <a class="code hl_variable" href="../../d0/d58/classgraph_1_1_rooted_tree.html#a2ee3ad1161ac2532da30c3e22c265ad3">level</a>[vertex] + 1;</div>
|
|
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> queue_of_vertices.push(neighbor);</div>
|
|
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> }</div>
|
|
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> }</div>
|
|
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> }</div>
|
|
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span>};</div>
|
|
</div>
|
|
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span></div>
|
|
<div class="foldopen" id="foldopen00145" data-start="{" data-end="};">
|
|
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"><a class="line" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html"> 145</a></span><span class="keyword">class </span><a class="code hl_function" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a80825a4fd4c41860b689d253dd2c8e93">LowestCommonAncestor</a> {</div>
|
|
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <span class="keyword">public</span>:</div>
|
|
<div class="foldopen" id="foldopen00151" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"><a class="line" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a80825a4fd4c41860b689d253dd2c8e93"> 151</a></span> <span class="keyword">explicit</span> <a class="code hl_function" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a80825a4fd4c41860b689d253dd2c8e93">LowestCommonAncestor</a>(<span class="keyword">const</span> <a class="code hl_class" href="../../d0/d58/classgraph_1_1_rooted_tree.html">RootedTree</a> &tree_) : tree(tree_) {</div>
|
|
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <a class="code hl_function" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a42589cc39d6bbff6c997152f1b96e356">populate_up</a>();</div>
|
|
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span></div>
|
|
<div class="foldopen" id="foldopen00164" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"><a class="line" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a60151e19512b48cc0b14ea121df00488"> 164</a></span> <span class="keywordtype">int</span> <a class="code hl_function" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a60151e19512b48cc0b14ea121df00488">lowest_common_ancestor</a>(<span class="keywordtype">int</span> u, <span class="keywordtype">int</span> v)<span class="keyword"> const </span>{</div>
|
|
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> <span class="comment">// Ensure u is the deeper (higher level) of the two vertices</span></div>
|
|
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> <span class="keywordflow">if</span> (tree.level[v] > tree.level[u]) {</div>
|
|
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> std::swap(u, v);</div>
|
|
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> }</div>
|
|
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> </div>
|
|
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> <span class="comment">// "Lift" u to the same level as v.</span></div>
|
|
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> <span class="keywordtype">int</span> level_diff = tree.level[u] - tree.level[v];</div>
|
|
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; (1 << i) <= level_diff; ++i) {</div>
|
|
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keywordflow">if</span> (level_diff & (1 << i)) {</div>
|
|
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> u = <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[u][i];</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> }</div>
|
|
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> assert(tree.level[u] == tree.level[v]);</div>
|
|
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> </div>
|
|
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <span class="keywordflow">if</span> (u == v) {</div>
|
|
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> <span class="keywordflow">return</span> u;</div>
|
|
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> }</div>
|
|
<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> <span class="comment">// "Lift" u and v to their 2^i th ancestor if they are different</span></div>
|
|
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(<a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[u].size()) - 1; i >= 0; --i) {</div>
|
|
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[u][i] != <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[v][i]) {</div>
|
|
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> u = <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[u][i];</div>
|
|
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> v = <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[v][i];</div>
|
|
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> }</div>
|
|
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> }</div>
|
|
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> </div>
|
|
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> <span class="comment">// As we regressed u an v such that they cannot further be lifted so</span></div>
|
|
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> <span class="comment">// that their ancestor would be different, the only logical</span></div>
|
|
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <span class="comment">// consequence is that their parent is the sought answer.</span></div>
|
|
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> assert(<a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[u][0] == <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[v][0]);</div>
|
|
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> <span class="keywordflow">return</span> <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[u][0];</div>
|
|
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> </div>
|
|
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> <span class="comment">/* \brief reference to the rooted tree this structure allows to query */</span></div>
|
|
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> <span class="keyword">const</span> <a class="code hl_class" href="../../d0/d58/classgraph_1_1_rooted_tree.html">RootedTree</a> &tree;</div>
|
|
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"><a class="line" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad"> 206</a></span> std::vector<std::vector<int> > <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>;</div>
|
|
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> </div>
|
|
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> <span class="keyword">protected</span>:</div>
|
|
<div class="foldopen" id="foldopen00212" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"><a class="line" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a42589cc39d6bbff6c997152f1b96e356"> 212</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a42589cc39d6bbff6c997152f1b96e356">populate_up</a>() {</div>
|
|
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>.resize(tree.number_of_vertices());</div>
|
|
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> vertex = 0; vertex < tree.number_of_vertices(); ++vertex) {</div>
|
|
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[vertex].push_back(tree.parent[vertex]);</div>
|
|
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> }</div>
|
|
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> level = 0; (1 << level) < tree.number_of_vertices(); ++level) {</div>
|
|
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> vertex = 0; vertex < tree.number_of_vertices(); ++vertex) {</div>
|
|
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> <span class="comment">// up[vertex][level + 1] = 2^(level + 1) th ancestor of vertex =</span></div>
|
|
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <span class="comment">// = 2^level th ancestor of 2^level th ancestor of vertex =</span></div>
|
|
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> <span class="comment">// = 2^level th ancestor of up[vertex][level]</span></div>
|
|
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> <a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[vertex].push_back(<a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[<a class="code hl_variable" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">up</a>[vertex][level]][level]);</div>
|
|
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> }</div>
|
|
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> }</div>
|
|
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span>};</div>
|
|
</div>
|
|
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> </div>
|
|
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span>} <span class="comment">// namespace graph</span></div>
|
|
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span></div>
|
|
<div class="foldopen" id="foldopen00234" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"><a class="line" href="../../de/dde/lowest__common__ancestor_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e"> 234</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/dde/lowest__common__ancestor_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e">tests</a>() {</div>
|
|
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> std::vector<std::pair<int, int> > edges = {</div>
|
|
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> {7, 1}, {1, 5}, {1, 3}, {3, 6}, {6, 2}, {2, 9}, {6, 8}, {4, 3}, {0, 4}};</div>
|
|
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> <a class="code hl_class" href="../../d0/d58/classgraph_1_1_rooted_tree.html">graph::RootedTree</a> t(edges, 3);</div>
|
|
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> <a class="code hl_class" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html">graph::LowestCommonAncestor</a> lca(t);</div>
|
|
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> assert(lca.<a class="code hl_function" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a60151e19512b48cc0b14ea121df00488">lowest_common_ancestor</a>(7, 4) == 3);</div>
|
|
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> assert(lca.<a class="code hl_function" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a60151e19512b48cc0b14ea121df00488">lowest_common_ancestor</a>(9, 6) == 6);</div>
|
|
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> assert(lca.<a class="code hl_function" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a60151e19512b48cc0b14ea121df00488">lowest_common_ancestor</a>(0, 0) == 0);</div>
|
|
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> assert(lca.<a class="code hl_function" href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a60151e19512b48cc0b14ea121df00488">lowest_common_ancestor</a>(8, 2) == 6);</div>
|
|
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span>}</div>
|
|
</div>
|
|
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span></div>
|
|
<div class="foldopen" id="foldopen00255" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"><a class="line" href="../../de/dde/lowest__common__ancestor_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 255</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../de/dde/lowest__common__ancestor_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
|
|
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> <a class="code hl_function" href="../../de/dde/lowest__common__ancestor_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e">tests</a>();</div>
|
|
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span> <span class="keywordflow">return</span> 0;</div>
|
|
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span>}</div>
|
|
</div>
|
|
<div class="ttc" id="aclassgraph_1_1_graph_html"><div class="ttname"><a href="../../dc/d61/classgraph_1_1_graph.html">graph::Graph</a></div><div class="ttdef"><b>Definition</b> <a href="../../df/d82/breadth__first__search_8cpp_source.html#l00064">breadth_first_search.cpp:64</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_graph_html_a59940c462861f2fcf4951d1b6c084e6a"><div class="ttname"><a href="../../dc/d61/classgraph_1_1_graph.html#a59940c462861f2fcf4951d1b6c084e6a">graph::Graph::neighbors</a></div><div class="ttdeci">std::vector< std::vector< int > > neighbors</div><div class="ttdoc">for each vertex it stores a list indicies of its neighbors</div><div class="ttdef"><b>Definition</b> <a href="#l00077">lowest_common_ancestor.cpp:77</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_graph_html_a8839fa14bff19d2deab4a618447c13e5"><div class="ttname"><a href="../../dc/d61/classgraph_1_1_graph.html#a8839fa14bff19d2deab4a618447c13e5">graph::Graph::Graph</a></div><div class="ttdeci">Graph(size_t N, const std::vector< std::pair< int, int > > &undirected_edges)</div><div class="ttdoc">Populate the adjacency list for each vertex in the graph. Assumes that evey edge is a pair of valid v...</div><div class="ttdef"><b>Definition</b> <a href="#l00062">lowest_common_ancestor.cpp:62</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_graph_html_a8930d1470d132b19e430d1c71f94c904"><div class="ttname"><a href="../../dc/d61/classgraph_1_1_graph.html#a8930d1470d132b19e430d1c71f94c904">graph::Graph::number_of_vertices</a></div><div class="ttdeci">int number_of_vertices() const</div><div class="ttdef"><b>Definition</b> <a href="#l00074">lowest_common_ancestor.cpp:74</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_lowest_common_ancestor_html"><div class="ttname"><a href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html">graph::LowestCommonAncestor</a></div><div class="ttdef"><b>Definition</b> <a href="#l00145">lowest_common_ancestor.cpp:145</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_lowest_common_ancestor_html_a42589cc39d6bbff6c997152f1b96e356"><div class="ttname"><a href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a42589cc39d6bbff6c997152f1b96e356">graph::LowestCommonAncestor::populate_up</a></div><div class="ttdeci">void populate_up()</div><div class="ttdef"><b>Definition</b> <a href="#l00212">lowest_common_ancestor.cpp:212</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_lowest_common_ancestor_html_a46d10f669791e3da9a4809bd8ff8d3ad"><div class="ttname"><a href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a46d10f669791e3da9a4809bd8ff8d3ad">graph::LowestCommonAncestor::up</a></div><div class="ttdeci">std::vector< std::vector< int > > up</div><div class="ttdoc">for every vertex stores a list of its ancestors by powers of two For each vertex, the first element o...</div><div class="ttdef"><b>Definition</b> <a href="#l00206">lowest_common_ancestor.cpp:206</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_lowest_common_ancestor_html_a60151e19512b48cc0b14ea121df00488"><div class="ttname"><a href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a60151e19512b48cc0b14ea121df00488">graph::LowestCommonAncestor::lowest_common_ancestor</a></div><div class="ttdeci">int lowest_common_ancestor(int u, int v) const</div><div class="ttdoc">Query the structure to find the lowest common ancestor. Assumes that the provided numbers are valid i...</div><div class="ttdef"><b>Definition</b> <a href="#l00164">lowest_common_ancestor.cpp:164</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_lowest_common_ancestor_html_a80825a4fd4c41860b689d253dd2c8e93"><div class="ttname"><a href="../../d9/d23/classgraph_1_1_lowest_common_ancestor.html#a80825a4fd4c41860b689d253dd2c8e93">graph::LowestCommonAncestor::LowestCommonAncestor</a></div><div class="ttdeci">LowestCommonAncestor(const RootedTree &tree_)</div><div class="ttdoc">Stores the tree and precomputs "up lifts".</div><div class="ttdef"><b>Definition</b> <a href="#l00151">lowest_common_ancestor.cpp:151</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_rooted_tree_html"><div class="ttname"><a href="../../d0/d58/classgraph_1_1_rooted_tree.html">graph::RootedTree</a></div><div class="ttdef"><b>Definition</b> <a href="#l00084">lowest_common_ancestor.cpp:84</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_rooted_tree_html_a2ee3ad1161ac2532da30c3e22c265ad3"><div class="ttname"><a href="../../d0/d58/classgraph_1_1_rooted_tree.html#a2ee3ad1161ac2532da30c3e22c265ad3">graph::RootedTree::level</a></div><div class="ttdeci">std::vector< int > level</div><div class="ttdoc">Stores the distance from the root.</div><div class="ttdef"><b>Definition</b> <a href="#l00106">lowest_common_ancestor.cpp:106</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_rooted_tree_html_a3831583a91914988897a4cc8748fda43"><div class="ttname"><a href="../../d0/d58/classgraph_1_1_rooted_tree.html#a3831583a91914988897a4cc8748fda43">graph::RootedTree::parent</a></div><div class="ttdeci">std::vector< int > parent</div><div class="ttdoc">Stores parent of every vertex and for root its own index. The root is technically not its own parent,...</div><div class="ttdef"><b>Definition</b> <a href="#l00104">lowest_common_ancestor.cpp:104</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_rooted_tree_html_aacdeecac857623e9fbfe92590f3c504d"><div class="ttname"><a href="../../d0/d58/classgraph_1_1_rooted_tree.html#aacdeecac857623e9fbfe92590f3c504d">graph::RootedTree::RootedTree</a></div><div class="ttdeci">RootedTree(const std::vector< std::pair< int, int > > &undirected_edges, int root_)</div><div class="ttdoc">Constructs the tree by calculating parent for every vertex. Assumes a valid description of a tree is ...</div><div class="ttdef"><b>Definition</b> <a href="#l00093">lowest_common_ancestor.cpp:93</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_rooted_tree_html_ab22a97bf6209a085fc2d788c3c0dacbe"><div class="ttname"><a href="../../d0/d58/classgraph_1_1_rooted_tree.html#ab22a97bf6209a085fc2d788c3c0dacbe">graph::RootedTree::root</a></div><div class="ttdeci">int root</div><div class="ttdoc">Index of the root vertex.</div><div class="ttdef"><b>Definition</b> <a href="#l00108">lowest_common_ancestor.cpp:108</a></div></div>
|
|
<div class="ttc" id="aclassgraph_1_1_rooted_tree_html_ae6928f3ebd491541e9570e746b877c1e"><div class="ttname"><a href="../../d0/d58/classgraph_1_1_rooted_tree.html#ae6928f3ebd491541e9570e746b877c1e">graph::RootedTree::populate_parents</a></div><div class="ttdeci">void populate_parents()</div><div class="ttdoc">Calculate the parents for all the vertices in the tree. Implements the breadth first search algorithm...</div><div class="ttdef"><b>Definition</b> <a href="#l00117">lowest_common_ancestor.cpp:117</a></div></div>
|
|
<div class="ttc" id="alowest__common__ancestor_8cpp_html_a483bb8ccf42aaf7375a83e91490eda1e"><div class="ttname"><a href="../../de/dde/lowest__common__ancestor_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e">tests</a></div><div class="ttdeci">static void tests()</div><div class="ttdef"><b>Definition</b> <a href="#l00234">lowest_common_ancestor.cpp:234</a></div></div>
|
|
<div class="ttc" id="alowest__common__ancestor_8cpp_html_ae66f6b31b5ad750f1fe042a706a4e3d4"><div class="ttname"><a href="../../de/dde/lowest__common__ancestor_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a></div><div class="ttdeci">int main()</div><div class="ttdef"><b>Definition</b> <a href="#l00255">lowest_common_ancestor.cpp:255</a></div></div>
|
|
<div class="ttc" id="anamespacegraph_html"><div class="ttname"><a href="../../df/dce/namespacegraph.html">graph</a></div><div class="ttdoc">Graph Algorithms.</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_12552d7fa429bf94a2e32e5cf39f7e69.html">graph</a></li><li class="navelem"><a class="el" href="../../de/dde/lowest__common__ancestor_8cpp.html">lowest_common_ancestor.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.13.2 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|