29 #ifndef DOXYGEN_SHOULD_SKIP_THIS 36 template <
typename STRUCT_CONSTRAINT >
39 _constraint(&constraint) {
44 template <
typename STRUCT_CONSTRAINT >
56 template <
typename STRUCT_CONSTRAINT >
69 template <
typename STRUCT_CONSTRAINT >
76 template <
typename STRUCT_CONSTRAINT >
77 GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >&
79 const GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >& from) {
91 template <
typename STRUCT_CONSTRAINT >
92 GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >&
94 GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >&& from) {
106 template <
typename STRUCT_CONSTRAINT >
111 std::vector< Set< GraphChange > > legal_changes;
112 # pragma omp parallel num_threads(__max_threads_number) 120 legal_changes.resize(num_threads);
127 if (i == this_thread) {
129 if (node1 != node2) {
131 ArcAddition arc_add(node1, node2);
133 legal_changes[this_thread].insert(std::move(arc_add));
137 ArcDeletion arc_del(node1, node2);
139 legal_changes[this_thread].insert(std::move(arc_del));
143 ArcReversal arc_rev(node1, node2);
145 legal_changes[this_thread].insert(std::move(arc_rev));
157 for (
const auto& changes : legal_changes) {
158 for (
const auto& change : changes) {
165 template <
typename STRUCT_CONSTRAINT >
167 const DiGraph& graph) {
173 template <
typename STRUCT_CONSTRAINT >
176 _target_nodes = nodes;
180 template <
typename STRUCT_CONSTRAINT >
183 _target_nodes.insert(node);
187 template <
typename STRUCT_CONSTRAINT >
191 _target_nodes.erase(node);
195 template <
typename STRUCT_CONSTRAINT >
202 template <
typename STRUCT_CONSTRAINT >
206 for (
Idx i = 0; i < nb_nodes; ++i) {
207 _tail_nodes.insert(i);
212 template <
typename STRUCT_CONSTRAINT >
219 template <
typename STRUCT_CONSTRAINT >
222 _tail_nodes.erase(node);
226 template <
typename STRUCT_CONSTRAINT >
233 template <
typename STRUCT_CONSTRAINT >
241 template <
typename STRUCT_CONSTRAINT >
249 template <
typename STRUCT_CONSTRAINT >
252 const ArcAddition& change) {}
255 template <
typename STRUCT_CONSTRAINT >
258 const ArcDeletion& change) {}
261 template <
typename STRUCT_CONSTRAINT >
264 const ArcReversal& change) {}
267 template <
typename STRUCT_CONSTRAINT >
270 const GraphChange& change) {}
273 template <
typename STRUCT_CONSTRAINT >
280 template <
typename STRUCT_CONSTRAINT >
284 # if defined(_OPENMP) && !defined(GUM_DEBUG_MODE) 293 template <
typename STRUCT_CONSTRAINT >
294 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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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