26 #ifndef DOXYGEN_SHOULD_SKIP_THIS 33 template <
typename STRUCT_CONSTRAINT >
36 _constraint(&constraint) {
41 template <
typename STRUCT_CONSTRAINT >
51 template <
typename STRUCT_CONSTRAINT >
62 template <
typename STRUCT_CONSTRAINT >
69 template <
typename STRUCT_CONSTRAINT >
70 GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT >&
72 const GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT >& from) {
83 template <
typename STRUCT_CONSTRAINT >
84 GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT >&
86 operator=(GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT >&& from) {
88 _graph = std::move(from._graph);
97 template <
typename STRUCT_CONSTRAINT >
102 std::vector< Set< GraphChange > > legal_changes;
103 # pragma omp parallel num_threads(int(__max_threads_number)) 111 legal_changes.resize(num_threads);
117 for (
const auto node1 :
_graph) {
118 if (i == this_thread) {
119 for (
const auto node2 : _graph) {
120 if (node1 != node2) {
122 ArcAddition arc_add(node1, node2);
124 legal_changes[this_thread].insert(std::move(arc_add));
128 ArcDeletion arc_del(node1, node2);
130 legal_changes[this_thread].insert(std::move(arc_del));
134 ArcReversal arc_rev(node1, node2);
136 legal_changes[this_thread].insert(std::move(arc_rev));
148 for (
const auto& changes : legal_changes) {
149 for (
const auto& change : changes) {
156 template <
typename STRUCT_CONSTRAINT >
158 const DiGraph& graph) {
167 template <
typename STRUCT_CONSTRAINT >
174 template <
typename STRUCT_CONSTRAINT >
181 template <
typename STRUCT_CONSTRAINT >
189 template <
typename STRUCT_CONSTRAINT >
191 const ArcAddition& change) {}
194 template <
typename STRUCT_CONSTRAINT >
196 const ArcDeletion& change) {}
199 template <
typename STRUCT_CONSTRAINT >
201 const ArcReversal& change) {}
204 template <
typename STRUCT_CONSTRAINT >
206 const GraphChange& change) {}
209 template <
typename STRUCT_CONSTRAINT >
216 template <
typename STRUCT_CONSTRAINT >
220 # if defined(_OPENMP) && !defined(GUM_DEBUG_MODE) 229 template <
typename STRUCT_CONSTRAINT >
230 INLINE STRUCT_CONSTRAINT&
unsigned int getNumberOfRunningThreads()
Get the current number of running threads.
unsigned int getThreadNumber()
Get the calling thread id.
Size __max_threads_number
the max number of threads authorized
void modifyGraph(const ArcAddition &change)
notify the generator of a change applied to the graph
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
void setMaxNbThreads(Size nb) noexcept
sets the maximum number of threads used to compute the set of changes
void setGraph(const DiGraph &graph)
sets a new graph from which the generator will compute possible changes
gum is the global namespace for all aGrUM entities
const iterator & end() const
returns an (unsafe) iterator on the end of the list of operators
iterator begin() const
returns an (unsafe) iterator on the beginning of the list of operators
DiGraph _graph
the graph on which we generate operators
Set< GraphChange > _legal_changes
the current set of graph changes
virtual ~GraphChangesGenerator4DiGraph()
destructor
typename Set< GraphChange >::const_iterator iterator
the iterator for parsing the list of possible graph change operators
STRUCT_CONSTRAINT & constraint() const noexcept
returns the constraint that is used by the generator
GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT > & operator=(const GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT > &from)
copy operator
GraphChangesGenerator4DiGraph(STRUCT_CONSTRAINT &constraint)
default constructor
void clearChanges() noexcept
empty the set of possible change operators that can be applied
STRUCT_CONSTRAINT * _constraint
the structural constraint used to restrict the changes
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
std::size_t Size
In aGrUM, hashed values are unsigned long int.