Files
ortools-clone/docs/cpp_graph/classoperations__research_1_1ConnectedComponents.html
Laurent Perron 6230c8e7a4 polish cpp doc
2019-07-12 13:25:23 -07:00

383 lines
24 KiB
HTML

<!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"/>-->
<link rel="stylesheet" type="text/css" href="ortools.css" title="default" media="screen,print" />
<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">
<span id="sfml">OR-Tools 7.2</span>
</div>
</div>
<link rel="icon" href="https://developers.google.com/optimization/images/orLogo.png">
<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 class="current"><a href="annotated.html"><span>Classes</span></a></li>
</ul>
</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:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classoperations__research_1_1ConnectedComponents.html','');});
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classoperations__research_1_1ConnectedComponents-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">operations_research::ConnectedComponents&lt; NodeIndex, ArcIndex &gt; Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename NodeIndex, typename ArcIndex&gt;<br />
class operations_research::ConnectedComponents&lt; NodeIndex, ArcIndex &gt;</h3>
<p>Template class implementing a Union-Find algorithm with path compression for maintaining the connected components of a graph. </p>
<p>See Cormen et al. 2nd Edition. MIT Press, 2001. ISBN 0-262-03293-7. Chapter 21: Data structures for Disjoint Sets, pp. 498-524. and Tarjan (1975). Efficiency of a Good But Not Linear <a class="el" href="classoperations__research_1_1Set.html">Set</a> Union Algorithm. Journal of the ACM 22(2):215-225 It is implemented as a template so that the size of NodeIndex can be chosen depending on the size of the graphs considered. The main interest is that arcs do not need to be kept. Thus the memory complexity is O(n) where n is the number of nodes in the graph. The complexity of this algorithm is O(n . alpha(n)) where alpha(n) is the inverse Ackermann function. alpha(n) &lt;= log(log(log(..log(log(n))..) In practice alpha(n) &lt;= 5. See Tarjan and van Leeuwen (1984). Worst-case analysis of set union algorithms. Journal of the ACM 31(2):245-281.</p>
<p>Usage example: ConnectedComponents&lt;int, int&gt; components; components.Init(num_nodes); for (int arc = 0; arc &lt; num_arcs; ++arc) { components.AddArc(tail[arc], head[arc]); } int num_connected_components = components.GetNumberOfConnectedComponents(); if (num_connected_components == 1) { ///&lt; Graph is completely connected. } ///&lt; Group the nodes in the same connected component together. ///&lt; group[class_number][i] contains the i-th node in group class_number. hash_map&lt;int, std::vector&lt;int&gt; &gt; group(num_connected_components); for (int node = 0; node &lt; num_nodes; ++node) { group[components.GetClassRepresentative(node)].push_back(node); }</p>
<p>Keywords: graph, connected components. </p>
<p class="definition">Definition at line <a class="el" href="connectivity_8h_source.html#l00067">67</a> of file <a class="el" href="connectivity_8h_source.html">connectivity.h</a>.</p>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:afcf39280b3d8dad94c80e2977415acac"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1ConnectedComponents.html#afcf39280b3d8dad94c80e2977415acac">ConnectedComponents</a> ()</td></tr>
<tr class="separator:afcf39280b3d8dad94c80e2977415acac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2d8283743a52c2e331309c33c798b23c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1ConnectedComponents.html#a2d8283743a52c2e331309c33c798b23c">Init</a> (<a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> num_nodes)</td></tr>
<tr class="memdesc:a2d8283743a52c2e331309c33c798b23c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reserves memory for num_nodes and resets the data structures. <a href="#a2d8283743a52c2e331309c33c798b23c">More...</a><br /></td></tr>
<tr class="separator:a2d8283743a52c2e331309c33c798b23c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b3b54f216c61506eaaace2d29819f79"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1ConnectedComponents.html#a2b3b54f216c61506eaaace2d29819f79">AddArc</a> (<a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> tail, <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> head)</td></tr>
<tr class="memdesc:a2b3b54f216c61506eaaace2d29819f79"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds the information that NodeIndex tail and NodeIndex head are connected. <a href="#a2b3b54f216c61506eaaace2d29819f79">More...</a><br /></td></tr>
<tr class="separator:a2b3b54f216c61506eaaace2d29819f79"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a257c3606c853fb7b79f62a5b62c65359"><td class="memTemplParams" colspan="2">template&lt;typename Graph &gt; </td></tr>
<tr class="memitem:a257c3606c853fb7b79f62a5b62c65359"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1ConnectedComponents.html#a257c3606c853fb7b79f62a5b62c65359">AddGraph</a> (const Graph &amp;graph)</td></tr>
<tr class="memdesc:a257c3606c853fb7b79f62a5b62c65359"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds a complete StarGraph to the object. <a href="#a257c3606c853fb7b79f62a5b62c65359">More...</a><br /></td></tr>
<tr class="separator:a257c3606c853fb7b79f62a5b62c65359"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a37aff82e0d7503f2dda86e1211cc89af"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1ConnectedComponents.html#a37aff82e0d7503f2dda86e1211cc89af">CompressPath</a> (<a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> node)</td></tr>
<tr class="memdesc:a37aff82e0d7503f2dda86e1211cc89af"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compresses the path for node. <a href="#a37aff82e0d7503f2dda86e1211cc89af">More...</a><br /></td></tr>
<tr class="separator:a37aff82e0d7503f2dda86e1211cc89af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa3cdc15d5fad9ed6672bd4e436d987dd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1ConnectedComponents.html#aa3cdc15d5fad9ed6672bd4e436d987dd">GetClassRepresentative</a> (<a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> node)</td></tr>
<tr class="memdesc:aa3cdc15d5fad9ed6672bd4e436d987dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the equivalence class representative for node. <a href="#aa3cdc15d5fad9ed6672bd4e436d987dd">More...</a><br /></td></tr>
<tr class="separator:aa3cdc15d5fad9ed6672bd4e436d987dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abe650442ae4ce0a544245721946abb89"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1ConnectedComponents.html#abe650442ae4ce0a544245721946abb89">GetNumberOfConnectedComponents</a> ()</td></tr>
<tr class="memdesc:abe650442ae4ce0a544245721946abb89"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of connected components. <a href="#abe650442ae4ce0a544245721946abb89">More...</a><br /></td></tr>
<tr class="separator:abe650442ae4ce0a544245721946abb89"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8de720dd960dc6e2e831bb27c3500466"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1ConnectedComponents.html#a8de720dd960dc6e2e831bb27c3500466">MergeClasses</a> (<a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> node1, <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> node2)</td></tr>
<tr class="memdesc:a8de720dd960dc6e2e831bb27c3500466"><td class="mdescLeft">&#160;</td><td class="mdescRight">Merges the equivalence classes of node1 and node2. <a href="#a8de720dd960dc6e2e831bb27c3500466">More...</a><br /></td></tr>
<tr class="separator:a8de720dd960dc6e2e831bb27c3500466"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="afcf39280b3d8dad94c80e2977415acac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afcf39280b3d8dad94c80e2977415acac">&#9670;&nbsp;</a></span>ConnectedComponents()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename NodeIndex, typename ArcIndex&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classoperations__research_1_1ConnectedComponents.html">operations_research::ConnectedComponents</a>&lt; <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>, <a class="el" href="namespaceoperations__research.html#a31d858394c5eed1fa21edc3da47047c1">ArcIndex</a> &gt;::<a class="el" href="classoperations__research_1_1ConnectedComponents.html">ConnectedComponents</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="connectivity_8h_source.html#l00069">69</a> of file <a class="el" href="connectivity_8h_source.html">connectivity.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a2b3b54f216c61506eaaace2d29819f79"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2b3b54f216c61506eaaace2d29819f79">&#9670;&nbsp;</a></span>AddArc()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename NodeIndex, typename ArcIndex&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classoperations__research_1_1ConnectedComponents.html">operations_research::ConnectedComponents</a>&lt; <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>, <a class="el" href="namespaceoperations__research.html#a31d858394c5eed1fa21edc3da47047c1">ArcIndex</a> &gt;::AddArc </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td>
<td class="paramname"><em>tail</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td>
<td class="paramname"><em>head</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Adds the information that NodeIndex tail and NodeIndex head are connected. </p>
<p class="definition">Definition at line <a class="el" href="connectivity_8h_source.html#l00083">83</a> of file <a class="el" href="connectivity_8h_source.html">connectivity.h</a>.</p>
</div>
</div>
<a id="a257c3606c853fb7b79f62a5b62c65359"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a257c3606c853fb7b79f62a5b62c65359">&#9670;&nbsp;</a></span>AddGraph()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename NodeIndex, typename ArcIndex&gt; </div>
<div class="memtemplate">
template&lt;typename Graph &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classoperations__research_1_1ConnectedComponents.html">operations_research::ConnectedComponents</a>&lt; <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>, <a class="el" href="namespaceoperations__research.html#a31d858394c5eed1fa21edc3da47047c1">ArcIndex</a> &gt;::AddGraph </td>
<td>(</td>
<td class="paramtype">const Graph &amp;&#160;</td>
<td class="paramname"><em>graph</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Adds a complete StarGraph to the object. </p>
<p>Note that Depth-First Search is a better algorithm for finding connected components on graphs. </p><dl class="todo"><dt><b><a class="el" href="todo.html#_todo000006">Todo:</a></b></dt><dd>(user): implement Depth-First Search-based connected components finder. </dd></dl>
<p class="definition">Definition at line <a class="el" href="connectivity_8h_source.html#l00095">95</a> of file <a class="el" href="connectivity_8h_source.html">connectivity.h</a>.</p>
</div>
</div>
<a id="a37aff82e0d7503f2dda86e1211cc89af"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a37aff82e0d7503f2dda86e1211cc89af">&#9670;&nbsp;</a></span>CompressPath()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename NodeIndex, typename ArcIndex&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> <a class="el" href="classoperations__research_1_1ConnectedComponents.html">operations_research::ConnectedComponents</a>&lt; <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>, <a class="el" href="namespaceoperations__research.html#a31d858394c5eed1fa21edc3da47047c1">ArcIndex</a> &gt;::CompressPath </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td>
<td class="paramname"><em>node</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Compresses the path for node. </p>
<p class="definition">Definition at line <a class="el" href="connectivity_8h_source.html#l00106">106</a> of file <a class="el" href="connectivity_8h_source.html">connectivity.h</a>.</p>
</div>
</div>
<a id="aa3cdc15d5fad9ed6672bd4e436d987dd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa3cdc15d5fad9ed6672bd4e436d987dd">&#9670;&nbsp;</a></span>GetClassRepresentative()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename NodeIndex, typename ArcIndex&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> <a class="el" href="classoperations__research_1_1ConnectedComponents.html">operations_research::ConnectedComponents</a>&lt; <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>, <a class="el" href="namespaceoperations__research.html#a31d858394c5eed1fa21edc3da47047c1">ArcIndex</a> &gt;::GetClassRepresentative </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td>
<td class="paramname"><em>node</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the equivalence class representative for node. </p>
<p class="definition">Definition at line <a class="el" href="connectivity_8h_source.html#l00123">123</a> of file <a class="el" href="connectivity_8h_source.html">connectivity.h</a>.</p>
</div>
</div>
<a id="abe650442ae4ce0a544245721946abb89"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abe650442ae4ce0a544245721946abb89">&#9670;&nbsp;</a></span>GetNumberOfConnectedComponents()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename NodeIndex, typename ArcIndex&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a> <a class="el" href="classoperations__research_1_1ConnectedComponents.html">operations_research::ConnectedComponents</a>&lt; <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>, <a class="el" href="namespaceoperations__research.html#a31d858394c5eed1fa21edc3da47047c1">ArcIndex</a> &gt;::GetNumberOfConnectedComponents </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the number of connected components. </p>
<p>Allocates num_nodes_ bits for the computation. </p>
<p class="definition">Definition at line <a class="el" href="connectivity_8h_source.html#l00129">129</a> of file <a class="el" href="connectivity_8h_source.html">connectivity.h</a>.</p>
</div>
</div>
<a id="a2d8283743a52c2e331309c33c798b23c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2d8283743a52c2e331309c33c798b23c">&#9670;&nbsp;</a></span>Init()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename NodeIndex, typename ArcIndex&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classoperations__research_1_1ConnectedComponents.html">operations_research::ConnectedComponents</a>&lt; <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>, <a class="el" href="namespaceoperations__research.html#a31d858394c5eed1fa21edc3da47047c1">ArcIndex</a> &gt;::Init </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td>
<td class="paramname"><em>num_nodes</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Reserves memory for num_nodes and resets the data structures. </p>
<p class="definition">Definition at line <a class="el" href="connectivity_8h_source.html#l00072">72</a> of file <a class="el" href="connectivity_8h_source.html">connectivity.h</a>.</p>
</div>
</div>
<a id="a8de720dd960dc6e2e831bb27c3500466"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8de720dd960dc6e2e831bb27c3500466">&#9670;&nbsp;</a></span>MergeClasses()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename NodeIndex, typename ArcIndex&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classoperations__research_1_1ConnectedComponents.html">operations_research::ConnectedComponents</a>&lt; <a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>, <a class="el" href="namespaceoperations__research.html#a31d858394c5eed1fa21edc3da47047c1">ArcIndex</a> &gt;::MergeClasses </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td>
<td class="paramname"><em>node1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">NodeIndex</a>&#160;</td>
<td class="paramname"><em>node2</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Merges the equivalence classes of node1 and node2. </p>
<p>It's faster (~10%) to swap the two values and have a single piece of code for merging the classes. </p>
<p class="definition">Definition at line <a class="el" href="connectivity_8h_source.html#l00138">138</a> of file <a class="el" href="connectivity_8h_source.html">connectivity.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="connectivity_8h_source.html">connectivity.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
</div>
<div id="footer-container">
<div id="footer">
</div>
</div>
</body>
</html>