Files
ortools-clone/docs/cpp_graph/connected__components_8h_source.html

78 lines
65 KiB
HTML
Raw Normal View History

2019-06-13 15:36:14 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OR-Tools</title>
<meta http-equiv="Content-Type" content="text/html;"/>
<meta charset="utf-8"/>
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
2019-06-20 23:08:48 +02:00
<link rel="stylesheet" type="text/css" href="ortools.css" title="default" media="screen,print" />
2019-06-13 15:36:14 +02:00
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div id="banner-container">
<div id="banner">
2019-06-29 18:18:08 +02:00
<span id="sfml">OR-Tools 7.2</span>
2019-06-13 15:36:14 +02:00
</div>
</div>
2019-06-29 18:18:08 +02:00
<link rel="icon" href="https://developers.google.com/optimization/images/orLogo.png">
2019-06-13 15:36:14 +02:00
<div id="content">
<!-- Generated by Doxygen 1.8.15 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_a7cc1eeded8f693d0da6c729bc88c45a.html">ortools</a></li><li class="navelem"><a class="el" href="dir_725f3a5915051842f84e3ea508be2a62.html">graph</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">connected_components.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="connected__components_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">// Copyright 2010-2018 Google LLC</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">// you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">// You may obtain a copy of the License at</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment">// See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment">// limitations under the License.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment">// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment">// you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment">// You may obtain a copy of the License at</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="comment">// See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="comment">// limitations under the License.</span></div><div class="line"><a name="l00026"
2019-06-13 15:36:14 +02:00
<div class="ttc" id="classConnectedComponentsFinder_html_a93b2c753675c77bfdbc0c33eb582380b"><div class="ttname"><a href="classConnectedComponentsFinder.html#a93b2c753675c77bfdbc0c33eb582380b">ConnectedComponentsFinder::AddNode</a></div><div class="ttdeci">void AddNode(T node)</div><div class="ttdoc">Adds a node in the graph.</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00200">connected_components.h:200</a></div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_a071f52956431e211e14ed7f3894c1d0b"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#a071f52956431e211e14ed7f3894c1d0b">DenseConnectedComponentsFinder::Connected</a></div><div class="ttdeci">bool Connected(int node1, int node2)</div></div>
<div class="ttc" id="namespaceutil_html"><div class="ttname"><a href="namespaceutil.html">util</a></div><div class="ttdoc">Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in c...</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00056">connected_components.h:56</a></div></div>
<div class="ttc" id="classConnectedComponentsFinder_html_aa669a113d3ee23c506b97949f740b1cc"><div class="ttname"><a href="classConnectedComponentsFinder.html#aa669a113d3ee23c506b97949f740b1cc">ConnectedComponentsFinder::ConnectedComponentsFinder</a></div><div class="ttdeci">ConnectedComponentsFinder()</div><div class="ttdoc">Constructs a connected components finder.</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00192">connected_components.h:192</a></div></div>
<div class="ttc" id="classConnectedComponentsFinder_html_a7a173636e3dce11a27f2f7121e01a563"><div class="ttname"><a href="classConnectedComponentsFinder.html#a7a173636e3dce11a27f2f7121e01a563">ConnectedComponentsFinder::GetSize</a></div><div class="ttdeci">int GetSize(T node)</div><div class="ttdoc">Finds the connected component containing a node, and returns the total number of nodes in that compon...</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00219">connected_components.h:219</a></div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_a46780e194c525fa9853fa899d69b4340"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#a46780e194c525fa9853fa899d69b4340">DenseConnectedComponentsFinder::SetNumberOfNodes</a></div><div class="ttdeci">void SetNumberOfNodes(int num_nodes)</div><div class="ttdoc">Sets the number of nodes in the graph.</div></div>
<div class="ttc" id="classConnectedComponentsFinder_html_a9eaa06cffceda90c1d44f550ad3459f3"><div class="ttname"><a href="classConnectedComponentsFinder.html#a9eaa06cffceda90c1d44f550ad3459f3">ConnectedComponentsFinder::FindConnectedComponents</a></div><div class="ttdeci">std::vector&lt; std::vector&lt; T &gt; &gt; FindConnectedComponents()</div><div class="ttdoc">Finds all the connected components and assigns them to components.</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00232">connected_components.h:232</a></div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_a33639c91528c2a525e1591df24ff2cc9"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#a33639c91528c2a525e1591df24ff2cc9">DenseConnectedComponentsFinder::DenseConnectedComponentsFinder</a></div><div class="ttdeci">DenseConnectedComponentsFinder()</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00083">connected_components.h:83</a></div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html">DenseConnectedComponentsFinder</a></div><div class="ttdoc">NOTE(user): The rest of the functions below should also be in namespace util, but for historical reas...</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00081">connected_components.h:81</a></div></div>
<div class="ttc" id="namespaceutil_html_a13f0e8f7e15873600cf8e395958c71e1"><div class="ttname"><a href="namespaceutil.html#a13f0e8f7e15873600cf8e395958c71e1">util::GetConnectedComponents</a></div><div class="ttdeci">std::vector&lt; int &gt; GetConnectedComponents(int num_nodes, const UndirectedGraph &amp;graph)</div><div class="ttdoc">Finds the connected components of the graph, using BFS internally.</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00289">connected_components.h:289</a></div></div>
<div class="ttc" id="classConnectedComponentsFinder_html_a350a0a0790e558f619478ce97c8f2ae7"><div class="ttname"><a href="classConnectedComponentsFinder.html#a350a0a0790e558f619478ce97c8f2ae7">ConnectedComponentsFinder::GetNumberOfNodes</a></div><div class="ttdeci">int GetNumberOfNodes() const</div><div class="ttdoc">Returns the current number of added distinct nodes.</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00261">connected_components.h:261</a></div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_a317fb43e59ef01ebe3d0d492b4ab33dd"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#a317fb43e59ef01ebe3d0d492b4ab33dd">DenseConnectedComponentsFinder::GetNumberOfNodes</a></div><div class="ttdeci">int GetNumberOfNodes() const</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00096">connected_components.h:96</a></div></div>
<div class="ttc" id="classConnectedComponentsFinder_html_a67dc34888511ab5b90b7389c90dbc1f8"><div class="ttname"><a href="classConnectedComponentsFinder.html#a67dc34888511ab5b90b7389c90dbc1f8">ConnectedComponentsFinder::Connected</a></div><div class="ttdeci">bool Connected(T node1, T node2)</div><div class="ttdoc">Returns true iff both nodes are in the same connected component.</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00211">connected_components.h:211</a></div></div>
<div class="ttc" id="classConnectedComponentsFinder_html_a30350bb98f0e1f7ae47ec1292d253b52"><div class="ttname"><a href="classConnectedComponentsFinder.html#a30350bb98f0e1f7ae47ec1292d253b52">ConnectedComponentsFinder::GetNumberOfComponents</a></div><div class="ttdeci">int GetNumberOfComponents() const</div><div class="ttdoc">Returns the current number of connected components.</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00253">connected_components.h:253</a></div></div>
<div class="ttc" id="classConnectedComponentsFinder_html_a21da7363443c34ad00c529fae4b3b3e2"><div class="ttname"><a href="classConnectedComponentsFinder.html#a21da7363443c34ad00c529fae4b3b3e2">ConnectedComponentsFinder::operator=</a></div><div class="ttdeci">ConnectedComponentsFinder &amp; operator=(const ConnectedComponentsFinder &amp;)=delete</div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_a5090a0bdc205d23778d2b8a742f5c5fd"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#a5090a0bdc205d23778d2b8a742f5c5fd">DenseConnectedComponentsFinder::GetNumberOfComponents</a></div><div class="ttdeci">int GetNumberOfComponents() const</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00095">connected_components.h:95</a></div></div>
<div class="ttc" id="classConnectedComponentsFinder_html"><div class="ttname"><a href="classConnectedComponentsFinder.html">ConnectedComponentsFinder</a></div><div class="ttdoc">Usage: ConnectedComponentsFinder&lt;MyNodeType&gt; cc; cc.AddNode(node1); cc.AddNode(node2); cc....</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00189">connected_components.h:189</a></div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_a0a639b64de57bc14f04f0f238e0092d1"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#a0a639b64de57bc14f04f0f238e0092d1">DenseConnectedComponentsFinder::GetSize</a></div><div class="ttdeci">int GetSize(int node)</div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_aee7f0057f42256a520b5ef32bae58b36"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#aee7f0057f42256a520b5ef32bae58b36">DenseConnectedComponentsFinder::GetComponentIds</a></div><div class="ttdeci">std::vector&lt; int &gt; GetComponentIds()</div><div class="ttdoc">Returns the same as GetConnectedComponents().</div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_a20f2a5d6bb7631a0dcdd678387a1b61a"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#a20f2a5d6bb7631a0dcdd678387a1b61a">DenseConnectedComponentsFinder::operator=</a></div><div class="ttdeci">DenseConnectedComponentsFinder &amp; operator=(const DenseConnectedComponentsFinder &amp;)=delete</div></div>
<div class="ttc" id="classConnectedComponentsFinder_html_a7f7b2f745e4c87bcaafec8fa295bfa91"><div class="ttname"><a href="classConnectedComponentsFinder.html#a7f7b2f745e4c87bcaafec8fa295bfa91">ConnectedComponentsFinder::FindConnectedComponents</a></div><div class="ttdeci">void FindConnectedComponents(std::vector&lt; typename internal::ConnectedComponentsTypeHelper&lt; T, CompareOrHashT &gt;::Set &gt; *components)</div><div class="ttdef"><b>Definition:</b> <a href="connected__components_8h_source.html#l00240">connected_components.h:240</a></div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_aba450cf3f16d9386d043c4354a19a4aa"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#aba450cf3f16d9386d043c4354a19a4aa">DenseConnectedComponentsFinder::AddEdge</a></div><div class="ttdeci">void AddEdge(int node1, int node2)</div><div class="ttdoc">The main API is the same as ConnectedComponentsFinder (below): see the homonymous functions there.</div></div>
<div class="ttc" id="classDenseConnectedComponentsFinder_html_afdcff89dd2374ce33c05934d328e64ec"><div class="ttname"><a href="classDenseConnectedComponentsFinder.html#afdcff89dd2374ce33c05934d328e64ec">DenseConnectedComponentsFinder::FindRoot</a></div><div class="ttdeci">int FindRoot(int node)</div><div class="ttdoc">Returns the root of the set for the given node.</div></div>
</div><!-- fragment --></div><!-- contents -->
</div>
<div id="footer-container">
<div id="footer">
</div>
</div>
</body>
</html>