26 #ifndef DOXYGEN_SHOULD_SKIP_THIS 33 template <
typename STRUCT_CONSTRAINT >
36 _constraint(&constraint) {
41 template <
typename STRUCT_CONSTRAINT >
52 template <
typename STRUCT_CONSTRAINT >
63 template <
typename STRUCT_CONSTRAINT >
70 template <
typename STRUCT_CONSTRAINT >
71 GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT >&
73 const GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT >& from) {
84 template <
typename STRUCT_CONSTRAINT >
85 GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT >&
87 operator=(GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT >&& from) {
89 _graph = std::move(from._graph);
98 template <
typename STRUCT_CONSTRAINT >
103 std::vector< Set< GraphChange > > legal_changes;
104 # pragma omp parallel num_threads(__max_threads_number) 112 legal_changes.resize(num_threads);
118 for (
const auto node1 :
_graph) {
119 if (i == this_thread) {
120 for (
const auto node2 : _graph) {
121 if (node1 != node2) {
123 EdgeAddition edge_add(node1, node2);
125 legal_changes[this_thread].insert(std::move(edge_add));
129 EdgeDeletion edge_del(node1, node2);
131 legal_changes[this_thread].insert(std::move(edge_del));
143 for (
const auto& changes : legal_changes) {
144 for (
const auto& change : changes) {
151 template <
typename STRUCT_CONSTRAINT >
153 const UndiGraph& graph) {
162 template <
typename STRUCT_CONSTRAINT >
169 template <
typename STRUCT_CONSTRAINT >
176 template <
typename STRUCT_CONSTRAINT >
184 template <
typename STRUCT_CONSTRAINT >
186 const EdgeAddition& change) {}
189 template <
typename STRUCT_CONSTRAINT >
191 const EdgeDeletion& change) {}
194 template <
typename STRUCT_CONSTRAINT >
196 const GraphChange& change) {}
199 template <
typename STRUCT_CONSTRAINT >
206 template <
typename STRUCT_CONSTRAINT >
210 # if defined(_OPENMP) && !defined(GUM_DEBUG_MODE) 219 template <
typename STRUCT_CONSTRAINT >
220 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
gum is the global namespace for all aGrUM entities
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