26 #ifndef DOXYGEN_SHOULD_SKIP_THIS 33 template <
typename STRUCT_CONSTRAINT >
36 _constraint(&constraint) {
41 template <
typename STRUCT_CONSTRAINT >
53 template <
typename STRUCT_CONSTRAINT >
66 template <
typename STRUCT_CONSTRAINT >
73 template <
typename STRUCT_CONSTRAINT >
74 GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >&
76 const GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >& from) {
88 template <
typename STRUCT_CONSTRAINT >
89 GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >&
91 GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >&& from) {
103 template <
typename STRUCT_CONSTRAINT >
108 std::vector< Set< GraphChange > > legal_changes;
109 # pragma omp parallel num_threads(__max_threads_number) 117 legal_changes.resize(num_threads);
124 if (i == this_thread) {
126 if (node1 != node2) {
128 ArcAddition arc_add(node1, node2);
130 legal_changes[this_thread].insert(std::move(arc_add));
134 ArcDeletion arc_del(node1, node2);
136 legal_changes[this_thread].insert(std::move(arc_del));
140 ArcReversal arc_rev(node1, node2);
142 legal_changes[this_thread].insert(std::move(arc_rev));
154 for (
const auto& changes : legal_changes) {
155 for (
const auto& change : changes) {
162 template <
typename STRUCT_CONSTRAINT >
164 const DiGraph& graph) {
170 template <
typename STRUCT_CONSTRAINT >
173 _target_nodes = nodes;
177 template <
typename STRUCT_CONSTRAINT >
180 _target_nodes.insert(node);
184 template <
typename STRUCT_CONSTRAINT >
188 _target_nodes.erase(node);
192 template <
typename STRUCT_CONSTRAINT >
199 template <
typename STRUCT_CONSTRAINT >
203 for (
Idx i = 0; i < nb_nodes; ++i) {
204 _tail_nodes.insert(i);
209 template <
typename STRUCT_CONSTRAINT >
216 template <
typename STRUCT_CONSTRAINT >
219 _tail_nodes.erase(node);
223 template <
typename STRUCT_CONSTRAINT >
230 template <
typename STRUCT_CONSTRAINT >
238 template <
typename STRUCT_CONSTRAINT >
246 template <
typename STRUCT_CONSTRAINT >
249 const ArcAddition& change) {}
252 template <
typename STRUCT_CONSTRAINT >
255 const ArcDeletion& change) {}
258 template <
typename STRUCT_CONSTRAINT >
261 const ArcReversal& change) {}
264 template <
typename STRUCT_CONSTRAINT >
267 const GraphChange& change) {}
270 template <
typename STRUCT_CONSTRAINT >
277 template <
typename STRUCT_CONSTRAINT >
281 # if defined(_OPENMP) && !defined(GUM_DEBUG_MODE) 290 template <
typename STRUCT_CONSTRAINT >
291 INLINE STRUCT_CONSTRAINT&
GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > & operator=(const GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > &from)
copy operator
NodeSet _tail_nodes
the tail nodes (other extremities than the targets)
STRUCT_CONSTRAINT & constraint() const noexcept
returns the constraint that is used by the generator
unsigned int getNumberOfRunningThreads()
Get the current number of running threads.
unsigned int getThreadNumber()
Get the calling thread id.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
Set< GraphChange > _legal_changes
the current set of operators
void eraseTarget(NodeId node)
removes a target
GraphChangesGeneratorOnSubDiGraph(STRUCT_CONSTRAINT &constraint)
default constructor
void eraseTail(NodeId node)
removes a tail node
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
const iterator & end() const
returns an (unsafe) iterator on the end of the list of operators
virtual ~GraphChangesGeneratorOnSubDiGraph()
destructor
gum is the global namespace for all aGrUM entities
void setTails(const NodeSet &nodes)
assign a set of "tail" nodes
void modifyGraph(const ArcAddition &change)
notify the operator set of a change applied to the graph
void clearChanges() noexcept
empty the set of possible change operators that can be applied
NodeSet _target_nodes
the set of target nodes
Size __max_threads_number
the max number of threads authorized
void setGraph(const DiGraph &graph)
sets a new graph from which the operator will compute possible changes
void _createChanges()
create the set of legal and illegal changes from a given graph
iterator begin() const
returns an (unsafe) iterator on the beginning of the list of operators
STRUCT_CONSTRAINT * _constraint
a reference on the structural constraint used to restrict the changes
void setMaxNbThreads(Size nb) noexcept
sets the maximum number of threads used to compute the set of changes
void setTargets(const NodeSet &nodes)
assign a set of target nodes
void addTarget(NodeId node)
adds a new target node
std::size_t Size
In aGrUM, hashed values are unsigned long int.
void addTail(NodeId node)
adds a new "tail" node
Size NodeId
Type for node ids.
typename Set< GraphChange >::const_iterator iterator
the iterator for parsing the list of possible graph change operators
void notifyGetCompleted()
notifies the generator that we have parsed all its legal changes