<ahref="#pub-methods">Public Member Functions</a>|
<ahref="classoperations__research_1_1MergingPartition-members.html">List of all members</a></div>
<divclass="headertitle">
<divclass="title">operations_research::MergingPartition Class Reference</div></div>
</div><!--header-->
<divclass="contents">
<p>Partition class that supports incremental merging, using the union-find algorithm (see <ahref="http://en.wikipedia.org/wiki/Disjoint-set_data_structure">http://en.wikipedia.org/wiki/Disjoint-set_data_structure</a>).
<trclass="memdesc:a561892525aa4b6891d5f7636f62cd749"><tdclass="mdescLeft"> </td><tdclass="mdescRight">At first, all nodes are in their own singleton part. <ahref="#a561892525aa4b6891d5f7636f62cd749">More...</a><br/></td></tr>
<trclass="memitem:a189669a00c0a94f224db9005c8925310"><tdclass="memItemLeft"align="right"valign="top">int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classoperations__research_1_1MergingPartition.html#a189669a00c0a94f224db9005c8925310">MergePartsOf</a> (int node1, int node2)</td></tr>
<trclass="memdesc:a189669a00c0a94f224db9005c8925310"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Complexity: amortized O(Ackermann⁻¹(N)) – which is essentially O(1) – where N is the number of nodes. <ahref="#a189669a00c0a94f224db9005c8925310">More...</a><br/></td></tr>
<trclass="memdesc:ab5aff2ca8ee76377b90e75f369a06965"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the representative of "node" (a node in the same equivalence class, which will also be returned for any other "node" in the same class). <ahref="#ab5aff2ca8ee76377b90e75f369a06965">More...</a><br/></td></tr>
<trclass="memitem:a09305f65b966f5d00cdb7c5e3fcec43a"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classoperations__research_1_1MergingPartition.html#a09305f65b966f5d00cdb7c5e3fcec43a">KeepOnlyOneNodePerPart</a> (std::vector< int > *nodes)</td></tr>
<trclass="memdesc:a09305f65b966f5d00cdb7c5e3fcec43a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Specialized reader API: prunes "nodes" to only keep at most one node per part: any node which is in the same part as an earlier node will be pruned. <ahref="#a09305f65b966f5d00cdb7c5e3fcec43a">More...</a><br/></td></tr>
<trclass="memitem:a450228c4fe64624a5c075a462ff91290"><tdclass="memItemLeft"align="right"valign="top">int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classoperations__research_1_1MergingPartition.html#a450228c4fe64624a5c075a462ff91290">FillEquivalenceClasses</a> (std::vector< int > *node_equivalence_classes)</td></tr>
<trclass="memdesc:a450228c4fe64624a5c075a462ff91290"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Output the whole partition as node equivalence classes: if there are K parts and N nodes, node_equivalence_classes[i] will contain the part index (a number in 0..K-1) of node #i. <ahref="#a450228c4fe64624a5c075a462ff91290">More...</a><br/></td></tr>
<trclass="memdesc:a62fb42554b2c7db5121b5b4230188d9d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Dump all components, with nodes sorted within each part and parts sorted lexicographically. <ahref="#a62fb42554b2c7db5121b5b4230188d9d">More...</a><br/></td></tr>
<trclass="memdesc:a955ac764e9c8dcd4358202de4ecd47fd"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Advanced usage: sets 'node' to be in its original singleton. <ahref="#a955ac764e9c8dcd4358202de4ecd47fd">More...</a><br/></td></tr>
<trclass="memdesc:a57d8288fbe286978c65abf82bd051000"><tdclass="mdescLeft"> </td><tdclass="mdescRight">FOR DEBUGGING OR SPECIAL "CONST" ACCESS ONLY: Find the root of the union-find tree with leaf 'node', i.e. <ahref="#a57d8288fbe286978c65abf82bd051000">More...</a><br/></td></tr>
<divclass="textblock"><p>Partition class that supports incremental merging, using the union-find algorithm (see <ahref="http://en.wikipedia.org/wiki/Disjoint-set_data_structure">http://en.wikipedia.org/wiki/Disjoint-set_data_structure</a>). </p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__partition_8h_source.html#l00203">203</a> of file <aclass="el"href="dynamic__partition_8h_source.html">dynamic_partition.h</a>.</p>
</div><h2class="groupheader">Constructor & Destructor Documentation</h2>
<p>At first, all nodes are in their own singleton part. </p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__partition_8h_source.html#l00206">206</a> of file <aclass="el"href="dynamic__partition_8h_source.html">dynamic_partition.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__partition_8h_source.html#l00207">207</a> of file <aclass="el"href="dynamic__partition_8h_source.html">dynamic_partition.h</a>.</p>
</div>
</div>
<h2class="groupheader">Member Function Documentation</h2>
<p>Output the whole partition as node equivalence classes: if there are K parts and N nodes, node_equivalence_classes[i] will contain the part index (a number in 0..K-1) of node #i. </p>
<p>Parts will be sorted by their first node (i.e. node 0 will always be in part 0; then the next node that isn't in part 0 will be in part 1, and so on). Returns the number K of classes. </p>
<p>FOR DEBUGGING OR SPECIAL "CONST" ACCESS ONLY: Find the root of the union-find tree with leaf 'node', i.e. </p>
<p>its representative node, but don't use path compression. The amortized complexity can be as bad as log(N), as opposed to the version using path compression. </p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__partition_8h_source.html#l00314">314</a> of file <aclass="el"href="dynamic__partition_8h_source.html">dynamic_partition.h</a>.</p>
<p>Get the representative of "node" (a node in the same equivalence class, which will also be returned for any other "node" in the same class). </p>
<p>The complexity if the same as <aclass="el"href="classoperations__research_1_1MergingPartition.html#a189669a00c0a94f224db9005c8925310"title="Complexity: amortized O(Ackermann⁻¹(N)) – which is essentially O(1) – where N is the number of nodes.">MergePartsOf()</a>. </p>
<p>Specialized reader API: prunes "nodes" to only keep at most one node per part: any node which is in the same part as an earlier node will be pruned. </p>
<p>Complexity: amortized O(Ackermann⁻¹(N)) – which is essentially O(1) – where N is the number of nodes. </p>
<p>Return value: If this merge caused a representative node (of either node1 or node2) to stop being a representative (because only one can remain); this method returns that removed representative. Otherwise it returns -1.</p>
<p>Details: a smaller part will always be merged onto a larger one. Upons ties, the smaller representative becomes the overall representative. </p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__partition_8h_source.html#l00210">210</a> of file <aclass="el"href="dynamic__partition_8h_source.html">dynamic_partition.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__partition_8h_source.html#l00251">251</a> of file <aclass="el"href="dynamic__partition_8h_source.html">dynamic_partition.h</a>.</p>
<p>Advanced usage: sets 'node' to be in its original singleton. </p>
<p>All nodes who may point to 'node' as a parent will remain in an inconsistent state. This can be used to reinitialize a <aclass="el"href="classoperations__research_1_1MergingPartition.html"title="Partition class that supports incremental merging, using the union-find algorithm (see http://en....">MergingPartition</a> that has been sparsely modified in O(<code>modifications</code>). CRASHES IF USED INCORRECTLY. </p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__partition_8h_source.html#l00339">339</a> of file <aclass="el"href="dynamic__partition_8h_source.html">dynamic_partition.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>