<ahref="cliques_8h.html">Go to the documentation of this file.</a><divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="comment">// Copyright 2010-2018 Google LLC</span></div><divclass="line"><aname="l00002"></a><spanclass="lineno"> 2</span> <spanclass="comment">// Licensed under the Apache License, Version 2.0 (the "License");</span></div><divclass="line"><aname="l00003"></a><spanclass="lineno"> 3</span> <spanclass="comment">// you may not use this file except in compliance with the License.</span></div><divclass="line"><aname="l00004"></a><spanclass="lineno"> 4</span> <spanclass="comment">// You may obtain a copy of the License at</span></div><divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment">//</span></div><divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div><divclass="line"><aname="l00007"></a><spanclass="lineno"> 7</span> <spanclass="comment">//</span></div><divclass="line"><aname="l00008"></a><spanclass="lineno"> 8</span> <spanclass="comment">// Unless required by applicable law or agreed to in writing, software</span></div><divclass="line"><aname="l00009"></a><spanclass="lineno"> 9</span> <spanclass="comment">// distributed under the License is distributed on an "AS IS" BASIS,</span></div><divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><divclass="line"><aname="l00011"></a><spanclass="lineno"> 11</span> <spanclass="comment">// See the License for the specific language governing permissions and</span></div><divclass="line"><aname="l00012"></a><spanclass="lineno"> 12</span> <spanclass="comment">// limitations under the License.</span></div><divclass="line"><aname="l00013"></a><spanclass="lineno"> 13</span> </div><divclass="line"><aname="l00014"></a><spanclass="lineno"> 14</span> <spanclass="comment">//</span></div><divclass="line"><aname="l00015"></a><spanclass="lineno"> 15</span> <spanclass="comment">// Maximal clique algorithms, based on the Bron-Kerbosch algorithm.</span></div><divclass="line"><aname="l00016"></a><spanclass="lineno"> 16</span> <spanclass="comment">// See http://en.wikipedia.org/wiki/Bron-Kerbosch_algorithm</span></div><divclass="line"><aname="l00017"></a><spanclass="lineno"> 17</span> <spanclass="comment">// and</span></div><divclass="line"><aname="l00018"></a><spanclass="lineno"> 18</span> <spanclass="comment">// C. Bron and J. Kerbosch, Joep, "Algorithm 457: finding all cliques of an</span></div><divclass="line"><aname="l00019"></a><spanclass="lineno"> 19</span> <spanclass="comment">// undirected graph", CACM 16 (9): 575-577, 1973.</span></div><divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> <spanclass="comment">// http://dl.acm.org/citation.cfm?id=362367&bnc=1.</span></div><divclass="line"><aname="l00021"></a><spanclass="lineno"> 21</span> <spanclass="comment">//</span></div><divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="comment">// Keywords: undirected graph, clique, clique cover, Bron, Kerbosch.</span></div><divclass="line"><aname="l00023"></a><spanclass="lineno"> 23</span> </div><divclass="line"><aname="l00024"></a><spanclass="lineno"> 24</span> <spanclass="preprocessor">#ifndef OR_TOOLS_GRAPH_CLIQUES_H_</span></div><divclass="line"><aname="l00025"></a><spanclass="lineno"> 25</span> <spanclass="preprocessor">#define OR_TOOLS_GRAPH_CLIQUES_H_</span></div><divclass="line"><aname="l00026"></a><spanclass="lineno"> 26</span> </div><divclass="line"><aname="l00027"></a><spanclass="lineno"> 27</span> <spanclass=
<divclass="ttc"id="namespaceoperations__research_html_a708cf34b342e7d2ed89a3b73dbec4eae"><divclass="ttname"><ahref="namespaceoperations__research.html#a708cf34b342e7d2ed89a3b73dbec4eae">operations_research::BronKerboschAlgorithmStatus</a></div><divclass="ttdeci">BronKerboschAlgorithmStatus</div><divclass="ttdoc">The status value returned by BronKerboschAlgorithm::Run and BronKerboschAlgorithm::RunIterations.</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00068">cliques.h:68</a></div></div>
<divclass="ttc"id="classoperations__research_1_1BronKerboschAlgorithm_html_aa28a934535a824fa63672b6c314b61cc"><divclass="ttname"><ahref="classoperations__research_1_1BronKerboschAlgorithm.html#aa28a934535a824fa63672b6c314b61cc">operations_research::BronKerboschAlgorithm::RunWithTimeLimit</a></div><divclass="ttdeci">BronKerboschAlgorithmStatus RunWithTimeLimit(int64 max_num_iterations, TimeLimit *time_limit)</div><divclass="ttdoc">Runs at most 'max_num_iterations' iterations of the Bron-Kerbosch algorithm, until the time limit is ...</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00508">cliques.h:508</a></div></div>
<divclass="ttc"id="namespaceoperations__research_html_af2d89e69d073dc3036a6de24710b416f"><divclass="ttname"><ahref="namespaceoperations__research.html#af2d89e69d073dc3036a6de24710b416f">operations_research::CliqueResponse</a></div><divclass="ttdeci">CliqueResponse</div><divclass="ttdoc">Possible return values of the callback for reporting cliques.</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00058">cliques.h:58</a></div></div>
<divclass="ttc"id="classoperations__research_1_1BronKerboschAlgorithm_html_a2c635d9b0b40012abf93606dd023e535"><divclass="ttname"><ahref="classoperations__research_1_1BronKerboschAlgorithm.html#a2c635d9b0b40012abf93606dd023e535">operations_research::BronKerboschAlgorithm::IsArcCallback</a></div><divclass="ttdeci">std::function< bool(NodeIndex, NodeIndex)> IsArcCallback</div><divclass="ttdoc">A callback called by the algorithm to test if there is an arc between a pair of nodes.</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00149">cliques.h:149</a></div></div>
<divclass="ttc"id="classoperations__research_1_1BronKerboschAlgorithm_html_a4a1ea40849bc5e92cecec1a90f2f2bb9"><divclass="ttname"><ahref="classoperations__research_1_1BronKerboschAlgorithm.html#a4a1ea40849bc5e92cecec1a90f2f2bb9">operations_research::BronKerboschAlgorithm::RunWithTimeLimit</a></div><divclass="ttdeci">BronKerboschAlgorithmStatus RunWithTimeLimit(TimeLimit *time_limit)</div><divclass="ttdoc">Runs the Bron-Kerbosch algorithm for at most kint64max iterations, until the time limit is excceded o...</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00203">cliques.h:203</a></div></div>
<divclass="ttc"id="classoperations__research_1_1BronKerboschAlgorithm_html"><divclass="ttname"><ahref="classoperations__research_1_1BronKerboschAlgorithm.html">operations_research::BronKerboschAlgorithm</a></div><divclass="ttdoc">Implements the Bron-Kerbosch algorithm for finding maximal cliques.</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00143">cliques.h:143</a></div></div>
<divclass="ttc"id="namespaceoperations__research_html_afe4b5a6c0e4019314f288e3f4307c114"><divclass="ttname"><ahref="namespaceoperations__research.html#afe4b5a6c0e4019314f288e3f4307c114">operations_research::CoverArcsByCliques</a></div><divclass="ttdeci">void CoverArcsByCliques(std::function< bool(int, int)> graph, int node_count, std::function< bool(const std::vector< int >&)> callback)</div><divclass="ttdoc">Covers the maximum number of arcs of the graph with cliques.</div></div>
<divclass="ttc"id="classoperations__research_1_1BronKerboschAlgorithm_html_a6dcb077f31531cc17c94da3364b6f099"><divclass="ttname"><ahref="classoperations__research_1_1BronKerboschAlgorithm.html#a6dcb077f31531cc17c94da3364b6f099">operations_research::BronKerboschAlgorithm::Run</a></div><divclass="ttdeci">BronKerboschAlgorithmStatus Run()</div><divclass="ttdoc">Runs the Bron-Kerbosch algorithm for kint64max iterations.</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00553">cliques.h:553</a></div></div>
<divclass="ttc"id="namespaceoperations__research_html_af2d89e69d073dc3036a6de24710b416fa615a46af313786fc4e349f34118be111"><divclass="ttname"><ahref="namespaceoperations__research.html#af2d89e69d073dc3036a6de24710b416fa615a46af313786fc4e349f34118be111">operations_research::CliqueResponse::STOP</a></div><divclass="ttdoc">The algorithm will stop the search immediately.</div></div>
<divclass="ttc"id="classoperations__research_1_1BronKerboschAlgorithm_html_ae7ca5a1b7767ea98c2f337e8b6f94c44"><divclass="ttname"><ahref="classoperations__research_1_1BronKerboschAlgorithm.html#ae7ca5a1b7767ea98c2f337e8b6f94c44">operations_research::BronKerboschAlgorithm::BronKerboschAlgorithm</a></div><divclass="ttdeci">BronKerboschAlgorithm(IsArcCallback is_arc, NodeIndex num_nodes, CliqueCallback clique_callback)</div><divclass="ttdoc">Initializes the Bron-Kerbosch algorithm for the given graph and clique callback function.</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00163">cliques.h:163</a></div></div>
<divclass="ttc"id="namespaceoperations__research_html_af2d89e69d073dc3036a6de24710b416fa2f453cfe638e57e27bb0c9512436111e"><divclass="ttname"><ahref="namespaceoperations__research.html#af2d89e69d073dc3036a6de24710b416fa2f453cfe638e57e27bb0c9512436111e">operations_research::CliqueResponse::CONTINUE</a></div><divclass="ttdoc">The algorithm will continue searching for other maximal cliques.</div></div>
<divclass="ttc"id="namespaceoperations__research_html_a708cf34b342e7d2ed89a3b73dbec4eaea8f7afecbc8fbc4cd0f50a57d1172482e"><divclass="ttname"><ahref="namespaceoperations__research.html#a708cf34b342e7d2ed89a3b73dbec4eaea8f7afecbc8fbc4cd0f50a57d1172482e">operations_research::BronKerboschAlgorithmStatus::COMPLETED</a></div><divclass="ttdoc">The algorithm has enumerated all maximal cliques.</div></div>
<divclass="ttc"id="classoperations__research_1_1BronKerboschAlgorithm_html_a14b12a4c5ea291009f47c1a98c458f81"><divclass="ttname"><ahref="classoperations__research_1_1BronKerboschAlgorithm.html#a14b12a4c5ea291009f47c1a98c458f81">operations_research::BronKerboschAlgorithm::RunIterations</a></div><divclass="ttdeci">BronKerboschAlgorithmStatus RunIterations(int64 max_num_iterations)</div><divclass="ttdoc">Runs at most 'max_num_iterations' iterations of the Bron-Kerbosch algorithm.</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00546">cliques.h:546</a></div></div>
<divclass="ttc"id="namespaceoperations__research_html"><divclass="ttname"><ahref="namespaceoperations__research.html">operations_research</a></div><divclass="ttdoc">Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...</div><divclass="ttdef"><b>Definition:</b><ahref="christofides_8h_source.html#l00033">christofides.h:33</a></div></div>
<divclass="ttc"id="namespaceoperations__research_html_a708cf34b342e7d2ed89a3b73dbec4eaea658f2cadfdf09b6046246e9314f7cd43"><divclass="ttname"><ahref="namespaceoperations__research.html#a708cf34b342e7d2ed89a3b73dbec4eaea658f2cadfdf09b6046246e9314f7cd43">operations_research::BronKerboschAlgorithmStatus::INTERRUPTED</a></div><divclass="ttdoc">The search algorithm was interrupted either because it reached the iteration limit or because the cli...</div></div>
<divclass="ttc"id="namespaceoperations__research_html_a0e629e35bfa311b31dd7f5065eb834bb"><divclass="ttname"><ahref="namespaceoperations__research.html#a0e629e35bfa311b31dd7f5065eb834bb">operations_research::NodeIndex</a></div><divclass="ttdeci">int32 NodeIndex</div><divclass="ttdoc">Standard instantiation of ForwardEbertGraph (named 'ForwardStarGraph') of EbertGraph (named 'StarGrap...</div><divclass="ttdef"><b>Definition:</b><ahref="ebert__graph_8h_source.html#l00192">ebert_graph.h:192</a></div></div>
<divclass="ttc"id="classoperations__research_1_1BronKerboschAlgorithm_html_ae49289c12a088e9f15bb26f927406c2f"><divclass="ttname"><ahref="classoperations__research_1_1BronKerboschAlgorithm.html#ae49289c12a088e9f15bb26f927406c2f">operations_research::BronKerboschAlgorithm::CliqueCallback</a></div><divclass="ttdeci">std::function< CliqueResponse(const std::vector< NodeIndex >&)> CliqueCallback</div><divclass="ttdoc">A callback called by the algorithm to report a maximal clique to the user.</div><divclass="ttdef"><b>Definition:</b><ahref="cliques_8h_source.html#l00159">cliques.h:159</a></div></div>