PandA-2024.02
filter_clique.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
38 #ifndef FILTER_CLIQUE_HPP
39 #define FILTER_CLIQUE_HPP
40 
42 
47 template <typename vertex_type>
48 struct filter_clique
49 {
50  virtual ~filter_clique() = default;
51 
52  virtual bool select_candidate_to_remove(const CustomOrderedSet<C_vertex>& candidate_clique, C_vertex& v,
54  const cc_compatibility_graph& cg) const = 0;
55  virtual size_t clique_cost(const CustomOrderedSet<C_vertex>& candidate_clique,
56  const CustomUnorderedMap<C_vertex, vertex_type>& converter) const = 0;
57  virtual bool is_filtering() const = 0;
58 };
59 
60 template <typename vertex_type>
61 struct no_filter_clique : public filter_clique<vertex_type>
62 {
65  const cc_compatibility_graph&) const override
66  {
67  return false;
68  }
69  size_t clique_cost(const CustomOrderedSet<C_vertex>& candidate_clique,
70  const CustomUnorderedMap<C_vertex, vertex_type>&) const override
71  {
72  return static_cast<size_t>(candidate_clique.size());
73  }
74  bool is_filtering() const override
75  {
76  return false;
77  }
78 };
79 
80 #endif
virtual bool select_candidate_to_remove(const CustomOrderedSet< C_vertex > &candidate_clique, C_vertex &v, const CustomUnorderedMap< C_vertex, vertex_type > &converter, const cc_compatibility_graph &cg) const =0
virtual ~filter_clique()=default
bool select_candidate_to_remove(const CustomOrderedSet< C_vertex > &, C_vertex &, const CustomUnorderedMap< C_vertex, vertex_type > &, const cc_compatibility_graph &) const override
bool is_filtering() const override
Functor used to reduce the size of clique: the rationale of filtering is that too many sharing may cr...
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
Definition: custom_map.hpp:148
size_t clique_cost(const CustomOrderedSet< C_vertex > &candidate_clique, const CustomUnorderedMap< C_vertex, vertex_type > &) const override
virtual size_t clique_cost(const CustomOrderedSet< C_vertex > &candidate_clique, const CustomUnorderedMap< C_vertex, vertex_type > &converter) const =0
boost::filtered_graph< boost_cc_compatibility_graph, cc_compatibility_graph_edge_selector< boost_cc_compatibility_graph >, cc_compatibility_graph_vertex_selector< boost_cc_compatibility_graph > > cc_compatibility_graph
compatibility graph
boost::graph_traits< cc_compatibility_graph >::vertex_descriptor C_vertex
cc_compatibility_graph vertex
virtual bool is_filtering() const =0

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13