81 _graph_(std::move(from._graph_)) {
97 if (
this != &from) {
_graph_ = std::move(from._graph_); }
105 for (
auto node:
graph)
108 for (
auto& arc:
graph.arcs()) {
111 "Graphs with directed cycles cannot be passed to StructuralConstraintDAG");
113 g.
addArc(arc.tail(), arc.head());
121 switch (change.
type()) {
139 "Graph change operation "
141 <<
"is not supported by the DAG structural constraint");
146 switch (change.
type()) {
169 "Graph change operation "
171 <<
" is not supported by the DAG structural constraints")
Base class for all oriented graphs.
void addArc(const NodeId tail, const NodeId head) override
insert a new arc into the directed graph
Exception : existence of a directed cycle in a graph.
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
Exception : operation not allowed.
The class for notifying learning algorithms of new arc additions.
The class for notifying learning algorithms of arc removals.
The class for notifying learning algorithms of arc reversals.
The graph change substituting a triangle node1->node2->node3 + node1->node3 into v-structure node2->n...
The graph change substituting a triangle node1->node2->node3 + node1->node3 into v-structure node1->n...
std::string typeAsString() const
returns a string corresponding to the type of the change
NodeId node1() const noexcept
returns the first node involved in the modification
GraphChangeType type() const noexcept
returns the type of the operation
NodeId node2() const noexcept
returns the second node involved in the modification
NodeId node3() const
returns the third node involved in the modification (if any)
The base class for structural constraints imposed by DAGs.
virtual ~StructuralConstraintDAG()
destructor
StructuralConstraintDAG & operator=(const StructuralConstraintDAG &from)
copy operator
void setGraph(const DAG &graph)
sets a new graph from which we will perform checking
void modifyGraphAlone(const ArcAddition &change)
notify the constraint of a modification of the graph
bool checkArcAdditionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to add arc (x,y)
StructuralConstraintDAG()
default constructor
bool checkArcReversalAlone(NodeId x, NodeId y) const
checks whether the constraints enable to reverse arc (x,y)
bool checkModificationAlone(const ArcAddition &change) const
checks whether the constraints enable to add an arc
void setGraphAlone(const DiGraph &graph)
sets a new graph from which we will perform checking
bool checkArcTriangleDeletion1Alone(NodeId node1, NodeId node2, NodeId node3) const
checks whether the constraints enable to apply an ArcTriangleDeletion1
bool checkArcTriangleDeletion2Alone(NodeId node1, NodeId node2, NodeId node3) const
checks whether the constraints enable to apply an ArcTriangleDeletion2
bool checkArcDeletionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to remove arc (x,y)
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
bool hasDirectedPath(const G &g, NodeId from, NodeId to)
Returns true if there is a directed path from from to to.
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities
the base class for structural constraints imposed by DAGs
the base class for structural constraints imposed by DAGs