Documentation for 2c68b68ca6

This commit is contained in:
github-actions
2023-07-25 01:00:26 +00:00
parent e9138e9e94
commit dc4d3f2965
66 changed files with 736 additions and 646 deletions

View File

@@ -119,8 +119,8 @@ Include dependency graph for dijkstra.cpp:</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 &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d64/classgreedy__algorithms_1_1_graph.html">greedy_algorithms::Graph</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wrapper class for storing a graph. <a href="../../d3/d64/classgreedy__algorithms_1_1_graph.html#details">More...</a><br /></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/daa/classgreedy__algorithms_1_1dijkstra_1_1_graph.html">greedy_algorithms::dijkstra::Graph</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wrapper class for storing a graph. <a href="../../d2/daa/classgreedy__algorithms_1_1dijkstra_1_1_graph.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
@@ -131,15 +131,15 @@ Namespaces</h2></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:ac6731ab96fb83453aff4682d16fe2ea7"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/d90/namespacegreedy__algorithms.html#ac6731ab96fb83453aff4682d16fe2ea7">greedy_algorithms::minimum_distance</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; int &gt; mdist, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; bool &gt; vset, int V)</td></tr>
<tr class="memdesc:ac6731ab96fb83453aff4682d16fe2ea7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility function that finds the vertex with the minimum distance in <code>mdist</code>. <br /></td></tr>
<tr class="separator:ac6731ab96fb83453aff4682d16fe2ea7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a58aba3d694f77ce934f4e94042321649"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/d90/namespacegreedy__algorithms.html#a58aba3d694f77ce934f4e94042321649">greedy_algorithms::print</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; int &gt; dist, int V)</td></tr>
<tr class="memdesc:a58aba3d694f77ce934f4e94042321649"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility function to print the distances to vertices. <br /></td></tr>
<tr class="separator:a58aba3d694f77ce934f4e94042321649"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04a39ac70bceeab6bcd3073da760e88a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/d90/namespacegreedy__algorithms.html#a04a39ac70bceeab6bcd3073da760e88a">greedy_algorithms::dijkstra</a> (<a class="el" href="../../d3/d64/classgreedy__algorithms_1_1_graph.html">Graph</a> graph, int src)</td></tr>
<tr class="memdesc:a04a39ac70bceeab6bcd3073da760e88a"><td class="mdescLeft">&#160;</td><td class="mdescRight">The main function that finds the shortest path from given source to all other vertices using Dijkstra's Algorithm. <br /></td></tr>
<tr class="separator:a04a39ac70bceeab6bcd3073da760e88a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af6cb29ca6dc5771439f6ea7262058a71"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dcb/greedy__algorithms_2dijkstra_8cpp.html#af6cb29ca6dc5771439f6ea7262058a71">greedy_algorithms::dijkstra::minimum_distance</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; int &gt; mdist, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; bool &gt; vset, int V)</td></tr>
<tr class="memdesc:af6cb29ca6dc5771439f6ea7262058a71"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility function that finds the vertex with the minimum distance in <code>mdist</code>. <br /></td></tr>
<tr class="separator:af6cb29ca6dc5771439f6ea7262058a71"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7341d7c76a6145e991cdd231f689fca8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dcb/greedy__algorithms_2dijkstra_8cpp.html#a7341d7c76a6145e991cdd231f689fca8">greedy_algorithms::dijkstra::print</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; int &gt; dist, int V)</td></tr>
<tr class="memdesc:a7341d7c76a6145e991cdd231f689fca8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility function to print the distances to vertices. <br /></td></tr>
<tr class="separator:a7341d7c76a6145e991cdd231f689fca8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af915876d0ca33cc71a6a6191a8cd3ccd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dcb/greedy__algorithms_2dijkstra_8cpp.html#af915876d0ca33cc71a6a6191a8cd3ccd">greedy_algorithms::dijkstra::dijkstra</a> (<a class="el" href="../../d2/daa/classgreedy__algorithms_1_1dijkstra_1_1_graph.html">Graph</a> graph, int src)</td></tr>
<tr class="memdesc:af915876d0ca33cc71a6a6191a8cd3ccd"><td class="mdescLeft">&#160;</td><td class="mdescRight">The main function that finds the shortest path from a given source to all other vertices using Dijkstra's Algorithm. <br /></td></tr>
<tr class="separator:af915876d0ca33cc71a6a6191a8cd3ccd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a483bb8ccf42aaf7375a83e91490eda1e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dcb/greedy__algorithms_2dijkstra_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e">tests</a> ()</td></tr>
<tr class="memdesc:a483bb8ccf42aaf7375a83e91490eda1e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self-test implementations. <br /></td></tr>
<tr class="separator:a483bb8ccf42aaf7375a83e91490eda1e"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -155,6 +155,82 @@ Functions</h2></td></tr>
<dd>
<a href="https://github.com/arpanjain97" target="_blank">Arpan Jain</a> </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="af915876d0ca33cc71a6a6191a8cd3ccd" name="af915876d0ca33cc71a6a6191a8cd3ccd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af915876d0ca33cc71a6a6191a8cd3ccd">&#9670;&#160;</a></span>dijkstra()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void greedy_algorithms::dijkstra::dijkstra </td>
<td>(</td>
<td class="paramtype"><a class="el" href="../../d2/daa/classgreedy__algorithms_1_1dijkstra_1_1_graph.html">Graph</a>&#160;</td>
<td class="paramname"><em>graph</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>src</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>The main function that finds the shortest path from a given source to all other vertices using Dijkstra's Algorithm. </p>
<dl class="section note"><dt>Note</dt><dd>This doesn't work on negative weights. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">graph</td><td>the graph to be processed </td></tr>
<tr><td class="paramname">src</td><td>the source of the given vertex </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 124</span> {</div>
<div class="line"><span class="lineno"> 125</span> <span class="keywordtype">int</span> V = <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.vertexNum;</div>
<div class="line"><span class="lineno"> 126</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int&gt;</a> mdist{}; <span class="comment">// Stores updated distances to the vertex</span></div>
<div class="line"><span class="lineno"> 127</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;bool&gt;</a> vset{}; <span class="comment">// `vset[i]` is true if the vertex `i` is included in the shortest path tree</span></div>
<div class="line"><span class="lineno"> 128</span> </div>
<div class="line"><span class="lineno"> 129</span> <span class="comment">// Initialize `mdist and `vset`. Set the distance of the source as zero</span></div>
<div class="line"><span class="lineno"> 130</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; V; i++) {</div>
<div class="line"><span class="lineno"> 131</span> mdist[i] = INT_MAX;</div>
<div class="line"><span class="lineno"> 132</span> vset[i] = <span class="keyword">false</span>;</div>
<div class="line"><span class="lineno"> 133</span> }</div>
<div class="line"><span class="lineno"> 134</span> </div>
<div class="line"><span class="lineno"> 135</span> mdist[src] = 0;</div>
<div class="line"><span class="lineno"> 136</span> </div>
<div class="line"><span class="lineno"> 137</span> <span class="comment">// iterate to find the shortest path</span></div>
<div class="line"><span class="lineno"> 138</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> count = 0; count &lt; V - 1; count++) {</div>
<div class="line"><span class="lineno"> 139</span> <span class="keywordtype">int</span> u = <a class="code hl_function" href="../../df/dcb/greedy__algorithms_2dijkstra_8cpp.html#af6cb29ca6dc5771439f6ea7262058a71">minimum_distance</a>(mdist, vset, V);</div>
<div class="line"><span class="lineno"> 140</span> </div>
<div class="line"><span class="lineno"> 141</span> vset[u] = <span class="keyword">true</span>;</div>
<div class="line"><span class="lineno"> 142</span> </div>
<div class="line"><span class="lineno"> 143</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> v = 0; v &lt; V; v++) {</div>
<div class="line"><span class="lineno"> 144</span> <span class="keywordflow">if</span> (!vset[v] &amp;&amp; <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[u][v] &amp;&amp;</div>
<div class="line"><span class="lineno"> 145</span> mdist[u] + <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[u][v] &lt; mdist[v]) {</div>
<div class="line"><span class="lineno"> 146</span> mdist[v] = mdist[u] + <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[u][v];</div>
<div class="line"><span class="lineno"> 147</span> }</div>
<div class="line"><span class="lineno"> 148</span> }</div>
<div class="line"><span class="lineno"> 149</span> }</div>
<div class="line"><span class="lineno"> 150</span> </div>
<div class="line"><span class="lineno"> 151</span> print(mdist, V);</div>
<div class="line"><span class="lineno"> 152</span>}</div>
<div class="ttc" id="agreedy__algorithms_2dijkstra_8cpp_html_af6cb29ca6dc5771439f6ea7262058a71"><div class="ttname"><a href="../../df/dcb/greedy__algorithms_2dijkstra_8cpp.html#af6cb29ca6dc5771439f6ea7262058a71">greedy_algorithms::dijkstra::minimum_distance</a></div><div class="ttdeci">int minimum_distance(std::vector&lt; int &gt; mdist, std::vector&lt; bool &gt; vset, int V)</div><div class="ttdoc">Utility function that finds the vertex with the minimum distance in mdist.</div><div class="ttdef"><b>Definition</b> dijkstra.cpp:82</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 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/dcb/greedy__algorithms_2dijkstra_8cpp_af915876d0ca33cc71a6a6191a8cd3ccd_cgraph.svg" width="375" height="76"><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="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&#160;</a></span>main()</h2>
@@ -173,10 +249,10 @@ Functions</h2></td></tr>
<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 196</span> {</div>
<div class="line"><span class="lineno"> 197</span> <a class="code hl_function" href="../../d7/d1e/graph_2dijkstra_8cpp.html#a88ec9ad42717780d6caaff9d3d6977f9">tests</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><span class="lineno"> 198</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 199</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 199</span> {</div>
<div class="line"><span class="lineno"> 200</span> <a class="code hl_function" href="../../d7/d1e/graph_2dijkstra_8cpp.html#a88ec9ad42717780d6caaff9d3d6977f9">tests</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><span class="lineno"> 201</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 202</span>}</div>
<div class="ttc" id="agraph_2dijkstra_8cpp_html_a88ec9ad42717780d6caaff9d3d6977f9"><div class="ttname"><a href="../../d7/d1e/graph_2dijkstra_8cpp.html#a88ec9ad42717780d6caaff9d3d6977f9">tests</a></div><div class="ttdeci">void tests()</div><div class="ttdef"><b>Definition</b> dijkstra.cpp:113</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -184,6 +260,118 @@ Here is the call graph for this function:</div>
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/dcb/greedy__algorithms_2dijkstra_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="524" height="315"><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="af6cb29ca6dc5771439f6ea7262058a71" name="af6cb29ca6dc5771439f6ea7262058a71"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af6cb29ca6dc5771439f6ea7262058a71">&#9670;&#160;</a></span>minimum_distance()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int greedy_algorithms::dijkstra::minimum_distance </td>
<td>(</td>
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; int &gt;&#160;</td>
<td class="paramname"><em>mdist</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; bool &gt;&#160;</td>
<td class="paramname"><em>vset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>V</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Utility function that finds the vertex with the minimum distance in <code>mdist</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">mdist</td><td>array of distances to each vertex </td></tr>
<tr><td class="paramname">vset</td><td>array indicating inclusion in the shortest path tree </td></tr>
<tr><td class="paramname">V</td><td>the number of vertices in the graph </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>index of the vertex with the minimum distance </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 82</span> {</div>
<div class="line"><span class="lineno"> 83</span> <span class="keywordtype">int</span> minVal = INT_MAX, minInd = 0;</div>
<div class="line"><span class="lineno"> 84</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; V; i++) {</div>
<div class="line"><span class="lineno"> 85</span> <span class="keywordflow">if</span> (!vset[i] &amp;&amp; (mdist[i] &lt; minVal)) {</div>
<div class="line"><span class="lineno"> 86</span> minVal = mdist[i];</div>
<div class="line"><span class="lineno"> 87</span> minInd = i;</div>
<div class="line"><span class="lineno"> 88</span> }</div>
<div class="line"><span class="lineno"> 89</span> }</div>
<div class="line"><span class="lineno"> 90</span> </div>
<div class="line"><span class="lineno"> 91</span> <span class="keywordflow">return</span> minInd;</div>
<div class="line"><span class="lineno"> 92</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/dcb/greedy__algorithms_2dijkstra_8cpp_af6cb29ca6dc5771439f6ea7262058a71_cgraph.svg" width="191" height="76"><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="a7341d7c76a6145e991cdd231f689fca8" name="a7341d7c76a6145e991cdd231f689fca8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7341d7c76a6145e991cdd231f689fca8">&#9670;&#160;</a></span>print()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void greedy_algorithms::dijkstra::print </td>
<td>(</td>
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; int &gt;&#160;</td>
<td class="paramname"><em>dist</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>V</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Utility function to print the distances to vertices. </p>
<p>This function prints the distances to each vertex in a tabular format. If the distance is equal to INT_MAX, it is displayed as "INF".</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dist</td><td>An array representing the distances to each vertex. </td></tr>
<tr><td class="paramname">V</td><td>The number of vertices in the graph. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 104</span> {</div>
<div class="line"><span class="lineno"> 105</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;\nVertex Distance\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 106</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; V; i++) {</div>
<div class="line"><span class="lineno"> 107</span> <span class="keywordflow">if</span> (dist[i] &lt; INT_MAX) {</div>
<div class="line"><span class="lineno"> 108</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot;\t&quot;</span> &lt;&lt; dist[i] &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 109</span> }</div>
<div class="line"><span class="lineno"> 110</span> <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 111</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot;\tINF&quot;</span> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 112</span> }</div>
<div class="line"><span class="lineno"> 113</span> }</div>
<div class="line"><span class="lineno"> 114</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><!-- fragment -->
</div>
</div>
<a id="a483bb8ccf42aaf7375a83e91490eda1e" name="a483bb8ccf42aaf7375a83e91490eda1e"></a>
@@ -211,43 +399,41 @@ Here is the call graph for this function:</div>
<p>Self-test implementations. </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 157</span> {</div>
<div class="line"><span class="lineno"> 158</span> <a class="code hl_class" href="../../d3/d64/classgreedy__algorithms_1_1_graph.html">greedy_algorithms::Graph</a> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>(8);</div>
<div class="line"><span class="lineno"> 159</span> </div>
<div class="line"><span class="lineno"> 160</span> <span class="comment">// 1st test.</span></div>
<div class="line"><span class="lineno"> 161</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(6, 2, 4);</div>
<div class="line"><span class="lineno"> 162</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(2, 6, 4);</div>
<div class="line"><span class="lineno"> 163</span> </div>
<div class="line"><span class="lineno"> 164</span> assert(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[6][2] == 4);</div>
<div class="line"><span class="lineno"> 165</span> </div>
<div class="line"><span class="lineno"> 166</span> <span class="comment">// 2nd test.</span></div>
<div class="line"><span class="lineno"> 167</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(0, 1, 1);</div>
<div class="line"><span class="lineno"> 168</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(1, 0, 1);</div>
<div class="line"><span class="lineno"> 169</span> </div>
<div class="line"><span class="lineno"> 170</span> assert(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[0][1] == 1);</div>
<div class="line"><span class="lineno"> 171</span> </div>
<div class="line"><span class="lineno"> 172</span> <span class="comment">// 3rd test.</span></div>
<div class="line"><span class="lineno"> 173</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(0, 2, 7);</div>
<div class="line"><span class="lineno"> 174</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(2, 0, 7);</div>
<div class="line"><span class="lineno"> 175</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(1, 2, 1);</div>
<div class="line"><span class="lineno"> 176</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(2, 1, 1);</div>
<div class="line"><span class="lineno"> 177</span> </div>
<div class="line"><span class="lineno"> 178</span> assert(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[0][2] == 7);</div>
<div class="line"><span class="lineno"> 179</span> </div>
<div class="line"><span class="lineno"> 180</span> <span class="comment">// 4th test.</span></div>
<div class="line"><span class="lineno"> 181</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(1, 3, 3);</div>
<div class="line"><span class="lineno"> 182</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(3, 1, 3);</div>
<div class="line"><span class="lineno"> 183</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(1, 4, 2);</div>
<div class="line"><span class="lineno"> 184</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(4, 1, 2);</div>
<div class="line"><span class="lineno"> 185</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(2, 3, 2);</div>
<div class="line"><span class="lineno"> 186</span> </div>
<div class="line"><span class="lineno"> 187</span> assert(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[1][3] == 3);</div>
<div class="line"><span class="lineno"> 188</span> </div>
<div class="line"><span class="lineno"> 189</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;All tests have successfully passed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 190</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="aclassgreedy__algorithms_1_1_graph_html"><div class="ttname"><a href="../../d3/d64/classgreedy__algorithms_1_1_graph.html">greedy_algorithms::Graph</a></div><div class="ttdoc">Wrapper class for storing a graph.</div><div class="ttdef"><b>Definition</b> dijkstra.cpp:33</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 class="fragment"><div class="line"><span class="lineno"> 160</span> {</div>
<div class="line"><span class="lineno"> 161</span> <a class="code hl_class" href="../../d2/daa/classgreedy__algorithms_1_1dijkstra_1_1_graph.html">greedy_algorithms::dijkstra::Graph</a> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>(8);</div>
<div class="line"><span class="lineno"> 162</span> </div>
<div class="line"><span class="lineno"> 163</span> <span class="comment">// 1st test.</span></div>
<div class="line"><span class="lineno"> 164</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(6, 2, 4);</div>
<div class="line"><span class="lineno"> 165</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(2, 6, 4);</div>
<div class="line"><span class="lineno"> 166</span> </div>
<div class="line"><span class="lineno"> 167</span> assert(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[6][2] == 4);</div>
<div class="line"><span class="lineno"> 168</span> </div>
<div class="line"><span class="lineno"> 169</span> <span class="comment">// 2nd test.</span></div>
<div class="line"><span class="lineno"> 170</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(0, 1, 1);</div>
<div class="line"><span class="lineno"> 171</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(1, 0, 1);</div>
<div class="line"><span class="lineno"> 172</span> </div>
<div class="line"><span class="lineno"> 173</span> assert(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[0][1] == 1);</div>
<div class="line"><span class="lineno"> 174</span> </div>
<div class="line"><span class="lineno"> 175</span> <span class="comment">// 3rd test.</span></div>
<div class="line"><span class="lineno"> 176</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(0, 2, 7);</div>
<div class="line"><span class="lineno"> 177</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(2, 0, 7);</div>
<div class="line"><span class="lineno"> 178</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(1, 2, 1);</div>
<div class="line"><span class="lineno"> 179</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(2, 1, 1);</div>
<div class="line"><span class="lineno"> 180</span> </div>
<div class="line"><span class="lineno"> 181</span> assert(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[0][2] == 7);</div>
<div class="line"><span class="lineno"> 182</span> </div>
<div class="line"><span class="lineno"> 183</span> <span class="comment">// 4th test.</span></div>
<div class="line"><span class="lineno"> 184</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(1, 3, 3);</div>
<div class="line"><span class="lineno"> 185</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(3, 1, 3);</div>
<div class="line"><span class="lineno"> 186</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(1, 4, 2);</div>
<div class="line"><span class="lineno"> 187</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(4, 1, 2);</div>
<div class="line"><span class="lineno"> 188</span> <a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.add_edge(2, 3, 2);</div>
<div class="line"><span class="lineno"> 189</span> </div>
<div class="line"><span class="lineno"> 190</span> assert(<a class="code hl_namespace" href="../../df/dce/namespacegraph.html">graph</a>.edges[1][3] == 3);</div>
<div class="line"><span class="lineno"> 191</span> </div>
<div class="line"><span class="lineno"> 192</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;All tests have successfully passed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 193</span>}</div>
<div class="ttc" id="aclassgreedy__algorithms_1_1dijkstra_1_1_graph_html"><div class="ttname"><a href="../../d2/daa/classgreedy__algorithms_1_1dijkstra_1_1_graph.html">greedy_algorithms::dijkstra::Graph</a></div><div class="ttdoc">Wrapper class for storing a graph.</div><div class="ttdef"><b>Definition</b> dijkstra.cpp:35</div></div>
</div><!-- fragment -->
</div>
</div>