<ahref="#pub-methods">Public Member Functions</a>|
<ahref="classoperations__research_1_1DynamicPermutation-members.html">List of all members</a></div>
<divclass="headertitle">
<divclass="title">operations_research::DynamicPermutation Class Reference</div></div>
</div><!--header-->
<divclass="contents">
<p>Maintains a 'partial' permutation of [0..n-1] onto itself, with a dynamic API allowing it to be built incrementally, and allowing some backtracking.
<trclass="memdesc:a5743ffc1c6fb22b0c4d63ce242135cbe"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Upon construction, every element i in [0..n-1] maps to itself. <ahref="#a5743ffc1c6fb22b0c4d63ce242135cbe">More...</a><br/></td></tr>
<trclass="memitem:af1058ff0d3ae20f6f313a82e12febbbf"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classoperations__research_1_1DynamicPermutation.html#af1058ff0d3ae20f6f313a82e12febbbf">AddMappings</a> (const std::vector< int >&src, const std::vector< int >&dst)</td></tr>
<trclass="memdesc:af1058ff0d3ae20f6f313a82e12febbbf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Declares a set of mappings for this permutation: src[i] will map to dst[i]. <ahref="#af1058ff0d3ae20f6f313a82e12febbbf">More...</a><br/></td></tr>
<trclass="memitem:a5493ce64ddd5b10144e57a0e630c1657"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classoperations__research_1_1DynamicPermutation.html#a5493ce64ddd5b10144e57a0e630c1657">UndoLastMappings</a> (std::vector< int > *undone_mapping_src)</td></tr>
<trclass="memdesc:a5493ce64ddd5b10144e57a0e630c1657"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Undoes the last <aclass="el"href="classoperations__research_1_1DynamicPermutation.html#af1058ff0d3ae20f6f313a82e12febbbf"title="Declares a set of mappings for this permutation: src[i] will map to dst[i].">AddMappings()</a> operation, and fills the "undone_mapping_src" vector with the src of that last operation. <ahref="#a5493ce64ddd5b10144e57a0e630c1657">More...</a><br/></td></tr>
<trclass="memdesc:a439e971c48da03d73621df8149c27167"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Makes the permutation back to the identity (i.e. <ahref="#a439e971c48da03d73621df8149c27167">More...</a><br/></td></tr>
<trclass="memdesc:a455f2fd63b17930ebb1d9a72f642ebd9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Forced-inline for the speed. <ahref="#a455f2fd63b17930ebb1d9a72f642ebd9">More...</a><br/></td></tr>
<trclass="memitem:a5f2bde228e58a2d71d457b0329f6ab2a"><tdclass="memItemLeft"align="right"valign="top">const std::vector< int >& </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classoperations__research_1_1DynamicPermutation.html#a5f2bde228e58a2d71d457b0329f6ab2a">AllMappingsSrc</a> () const</td></tr>
<trclass="memdesc:a5f2bde228e58a2d71d457b0329f6ab2a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the union of all "src" ever given to <aclass="el"href="classoperations__research_1_1DynamicPermutation.html#af1058ff0d3ae20f6f313a82e12febbbf"title="Declares a set of mappings for this permutation: src[i] will map to dst[i].">AddMappings()</a>. <ahref="#a5f2bde228e58a2d71d457b0329f6ab2a">More...</a><br/></td></tr>
<trclass="memdesc:a26a6e9c551114feee802a46a49cf2b4a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">While the permutation is partially being built, the orbit of elements will either form unclosed paths, or closed cycles. <ahref="#a26a6e9c551114feee802a46a49cf2b4a">More...</a><br/></td></tr>
<trclass="memitem:acf9308c2eb8d7c1d5b5e3193c672f36d"><tdclass="memItemLeft"align="right"valign="top">const std::set< int >& </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classoperations__research_1_1DynamicPermutation.html#acf9308c2eb8d7c1d5b5e3193c672f36d">LooseEnds</a> () const</td></tr>
<trclass="memdesc:acf9308c2eb8d7c1d5b5e3193c672f36d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The exhaustive set of the 'loose end' of the incomplete cycles (e.g., paths) built so far. <ahref="#acf9308c2eb8d7c1d5b5e3193c672f36d">More...</a><br/></td></tr>
<trclass="memdesc:afc0264e56e82c46a27db9b57ed58cd45"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a <aclass="el"href="classoperations__research_1_1SparsePermutation.html"title="A compact representation for permutations of {0..N-1} that displaces few elements: it needs only O(K)...">SparsePermutation</a> representing the current permutation. <ahref="#afc0264e56e82c46a27db9b57ed58cd45">More...</a><br/></td></tr>
<divclass="textblock"><p>Maintains a 'partial' permutation of [0..n-1] onto itself, with a dynamic API allowing it to be built incrementally, and allowing some backtracking. </p>
<p>This is tuned for a specific usage by ./find_graph_symmetries.cc.</p>
<p>RAM usage: as of 2014-04, this class needs less than: 32.125 * (n + 2 * support_size) bytes. </p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__permutation_8h_source.html#l00033">33</a> of file <aclass="el"href="dynamic__permutation_8h_source.html">dynamic_permutation.h</a>.</p>
</div><h2class="groupheader">Constructor & Destructor Documentation</h2>
<p>Returns the union of all "src" ever given to <aclass="el"href="classoperations__research_1_1DynamicPermutation.html#af1058ff0d3ae20f6f313a82e12febbbf"title="Declares a set of mappings for this permutation: src[i] will map to dst[i].">AddMappings()</a>. </p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__permutation_8h_source.html#l00067">67</a> of file <aclass="el"href="dynamic__permutation_8h_source.html">dynamic_permutation.h</a>.</p>
<p>Creates a <aclass="el"href="classoperations__research_1_1SparsePermutation.html"title="A compact representation for permutations of {0..N-1} that displaces few elements: it needs only O(K)...">SparsePermutation</a> representing the current permutation. </p>
<p>Requirements: the permutation must only have cycles.</p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__permutation_8h_source.html#l00114">114</a> of file <aclass="el"href="dynamic__permutation_8h_source.html">dynamic_permutation.h</a>.</p>
<p>The exhaustive set of the 'loose end' of the incomplete cycles (e.g., paths) built so far. </p>
<dlclass="todo"><dt><b><aclass="el"href="todo.html#_todo000004">Todo:</a></b></dt><dd>(user): use a faster underlying container like SparseBitSet, and tweak this API accordingly. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="dynamic__permutation_8h_source.html#l00083">83</a> of file <aclass="el"href="dynamic__permutation_8h_source.html">dynamic_permutation.h</a>.</p>
<p>While the permutation is partially being built, the orbit of elements will either form unclosed paths, or closed cycles. </p>
<p>Forced-inline for the speed.</p>
<p>In the former case, RootOf(i) returns the start of the path where i lies. If i is on a cycle, RootOf(i) will return some element of its cycle (meaning that if i maps to itself, RootOf(i) = i).</p>
<p>Complexity: O(log(orbit size)) in average, assuming that the mappings are added in a random order. O(orbit size) in the worst case. </p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__permutation_8h_source.html#l00121">121</a> of file <aclass="el"href="dynamic__permutation_8h_source.html">dynamic_permutation.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="dynamic__permutation_8h_source.html#l00038">38</a> of file <aclass="el"href="dynamic__permutation_8h_source.html">dynamic_permutation.h</a>.</p>
<p>Undoes the last <aclass="el"href="classoperations__research_1_1DynamicPermutation.html#af1058ff0d3ae20f6f313a82e12febbbf"title="Declares a set of mappings for this permutation: src[i] will map to dst[i].">AddMappings()</a> operation, and fills the "undone_mapping_src" vector with the src of that last operation. </p>
<p>This works like an undo stack. For example, applying the sequence (Add, Add, Add, Undo, Add, Undo, Undo) has exactly the same effect as applying the first Add() alone. If you call this too may times (i.e. there is nothing left to undo), it is simply a no-op.</p>
<p>Complexity: same as the <aclass="el"href="classoperations__research_1_1DynamicPermutation.html#af1058ff0d3ae20f6f313a82e12febbbf"title="Declares a set of mappings for this permutation: src[i] will map to dst[i].">AddMappings()</a> operation being undone. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>