29 #ifndef DOXYGEN_SHOULD_SKIP_THIS 36 template <
typename STRUCT_CONSTRAINT >
39 _constraint(&constraint) {
44 template <
typename STRUCT_CONSTRAINT >
55 template <
typename STRUCT_CONSTRAINT >
66 template <
typename STRUCT_CONSTRAINT >
73 template <
typename STRUCT_CONSTRAINT >
74 GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT >&
76 const GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT >& from) {
87 template <
typename STRUCT_CONSTRAINT >
88 GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT >&
90 operator=(GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT >&& from) {
92 _graph = std::move(from._graph);
101 template <
typename STRUCT_CONSTRAINT >
106 std::vector< Set< GraphChange > > legal_changes;
107 # pragma omp parallel num_threads(__max_threads_number) 115 legal_changes.resize(num_threads);
121 for (
const auto node1 :
_graph) {
122 if (i == this_thread) {
123 for (
const auto node2 : _graph) {
124 if (node1 != node2) {
126 EdgeAddition edge_add(node1, node2);
128 legal_changes[this_thread].insert(std::move(edge_add));
132 EdgeDeletion edge_del(node1, node2);
134 legal_changes[this_thread].insert(std::move(edge_del));
146 for (
const auto& changes : legal_changes) {
147 for (
const auto& change : changes) {
154 template <
typename STRUCT_CONSTRAINT >
156 const UndiGraph& graph) {
165 template <
typename STRUCT_CONSTRAINT >
172 template <
typename STRUCT_CONSTRAINT >
179 template <
typename STRUCT_CONSTRAINT >
187 template <
typename STRUCT_CONSTRAINT >
189 const EdgeAddition& change) {}
192 template <
typename STRUCT_CONSTRAINT >
194 const EdgeDeletion& change) {}
197 template <
typename STRUCT_CONSTRAINT >
199 const GraphChange& change) {}
202 template <
typename STRUCT_CONSTRAINT >
209 template <
typename STRUCT_CONSTRAINT >
213 # if defined(_OPENMP) && !defined(GUM_DEBUG_MODE) 222 template <
typename STRUCT_CONSTRAINT >
223 INLINE STRUCT_CONSTRAINT&
unsigned int getNumberOfRunningThreads()
Get the current number of running threads.
void _createChanges()
create the set of legal and illegal changes from a given graph
void notifyGetCompleted()
notifies the generator that we have parsed all its legal changes
unsigned int getThreadNumber()
Get the calling thread id.
void setGraph(const UndiGraph &graph)
sets a new graph from which the operator will compute possible changes
virtual ~GraphChangesGenerator4UndiGraph()
destructor
iterator begin() const
returns an (unsafe) iterator on the beginning of the list of operators
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
STRUCT_CONSTRAINT * _constraint
a reference on the structural constraint used to restrict the changes
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
GraphChangesGenerator4UndiGraph(STRUCT_CONSTRAINT &constraint)
default constructor
UndiGraph _graph
the graph on which we generate operators
void clearChanges() noexcept
empty the set of possible change operators that can be applied
Set< GraphChange > _legal_changes
the current set of operators
typename Set< GraphChange >::const_iterator iterator
the iterator for parsing the list of possible graph change operators
Size __max_threads_number
the max number of threads authorized
void setMaxNbThreads(Size nb) noexcept
sets the maximum number of threads used to compute the set of changes
STRUCT_CONSTRAINT & constraint() const noexcept
returns the constraint that is used by the generator
GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT > & operator=(const GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT > &from)
copy operator
std::size_t Size
In aGrUM, hashed values are unsigned long int.
void modifyGraph(const EdgeAddition &change)
notify the operator set of a change applied to the graph
const iterator & end() const
returns an (unsafe) iterator on the end of the list of operators