aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::learning::StructuralConstraintPossibleEdges Class Reference

the structural constraint for forbidding the creation of some arcs except those defined in the class during structure learning More...

#include <structuralConstraintPossibleEdges.h>

Inheritance diagram for gum::learning::StructuralConstraintPossibleEdges:
Collaboration diagram for gum::learning::StructuralConstraintPossibleEdges:

Public Types

using allConstraints = _ConstraintSet_< void >

Public Member Functions

Constructors / Destructors
 StructuralConstraintPossibleEdges ()
 default constructor
 StructuralConstraintPossibleEdges (const DiGraph &graph)
 constructor starting with a given graph
 StructuralConstraintPossibleEdges (const StructuralConstraintPossibleEdges &from)
 copy constructor
 StructuralConstraintPossibleEdges (StructuralConstraintPossibleEdges &&from)
 move constructor
virtual ~StructuralConstraintPossibleEdges ()
 destructor
Operators
StructuralConstraintPossibleEdgesoperator= (const StructuralConstraintPossibleEdges &from)
 copy operator
StructuralConstraintPossibleEdgesoperator= (StructuralConstraintPossibleEdges &&from)
 move operator
Specific Accessors / Modifiers
void setEdges (const EdgeSet &set)
 assign a set of forbidden arcs
void addEdge (const Edge &edge)
 assign a new forbidden arc
void eraseEdge (const Edge &edge)
 remove a forbidden arc
const EdgeSetedges () const
 returns the set of mandatory arcs
void setGraphAlone (const DiGraph &graph)
 sets a new graph from which we will perform checkings
void modifyGraphAlone (const ArcAddition &change)
 notify the constraint of a modification of the graph
void modifyGraphAlone (const ArcDeletion &change)
 notify the constraint of a modification of the graph
void modifyGraphAlone (const ArcReversal &change)
 notify the constraint of a modification of the graph
void modifyGraphAlone (const GraphChange &change)
 notify the constraint of a modification of the graph
bool isAlwaysInvalidAlone (const GraphChange &change) const
 indicates whether a change will always violate the constraint
bool checkArcAdditionAlone (NodeId x, NodeId y) const
 checks whether the constraints enable to add arc (x,y)
bool checkArcDeletionAlone (NodeId x, NodeId y) const
 checks whether the constraints enable to remove arc (x,y)
bool checkArcReversalAlone (NodeId x, NodeId y) const
 checks whether the constraints enable to reverse arc (x,y)
bool checkModificationAlone (const GraphChange &change) const
 checks whether the constraints enable to perform a graph change
bool checkModificationAlone (const ArcAddition &change) const
 checks whether the constraints enable to add an arc
bool checkModificationAlone (const ArcDeletion &change) const
 checks whether the constraints enable to remove an arc
bool checkModificationAlone (const ArcReversal &change) const
 checks whether the constraints enable to reverse an arc

Protected Attributes

EdgeSet _PossibleEdges_possible_edges_
 the PossibleEdges on which we perform checks

Detailed Description

the structural constraint for forbidding the creation of some arcs except those defined in the class during structure learning

Definition at line 64 of file structuralConstraintPossibleEdges.h.

Member Typedef Documentation

◆ allConstraints

using gum::learning::StructuralConstraintEmpty::allConstraints = _ConstraintSet_< void >
inherited

Definition at line 61 of file structuralConstraint.h.

Constructor & Destructor Documentation

◆ StructuralConstraintPossibleEdges() [1/4]

gum::learning::StructuralConstraintPossibleEdges::StructuralConstraintPossibleEdges ( )

default constructor

Definition at line 61 of file structuralConstraintPossibleEdges.cpp.

References StructuralConstraintPossibleEdges().

Referenced by StructuralConstraintPossibleEdges(), StructuralConstraintPossibleEdges(), StructuralConstraintPossibleEdges(), StructuralConstraintPossibleEdges(), ~StructuralConstraintPossibleEdges(), operator=(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StructuralConstraintPossibleEdges() [2/4]

gum::learning::StructuralConstraintPossibleEdges::StructuralConstraintPossibleEdges ( const DiGraph & graph)

constructor starting with a given graph

Definition at line 66 of file structuralConstraintPossibleEdges.cpp.

66 {
67 setGraph(graph);
68 GUM_CONSTRUCTOR(StructuralConstraintPossibleEdges);
69 }

References StructuralConstraintPossibleEdges().

Here is the call graph for this function:

◆ StructuralConstraintPossibleEdges() [3/4]

gum::learning::StructuralConstraintPossibleEdges::StructuralConstraintPossibleEdges ( const StructuralConstraintPossibleEdges & from)

copy constructor

Definition at line 72 of file structuralConstraintPossibleEdges.cpp.

73 :
74 _PossibleEdges_possible_edges_(from._PossibleEdges_possible_edges_) {
76 }
EdgeSet _PossibleEdges_possible_edges_
the PossibleEdges on which we perform checks

References StructuralConstraintPossibleEdges(), and _PossibleEdges_possible_edges_.

Here is the call graph for this function:

◆ StructuralConstraintPossibleEdges() [4/4]

gum::learning::StructuralConstraintPossibleEdges::StructuralConstraintPossibleEdges ( StructuralConstraintPossibleEdges && from)

move constructor

Definition at line 79 of file structuralConstraintPossibleEdges.cpp.

80 :
81 _PossibleEdges_possible_edges_(std::move(from._PossibleEdges_possible_edges_)) {
83 }

References StructuralConstraintPossibleEdges(), and _PossibleEdges_possible_edges_.

Here is the call graph for this function:

◆ ~StructuralConstraintPossibleEdges()

gum::learning::StructuralConstraintPossibleEdges::~StructuralConstraintPossibleEdges ( )
virtual

destructor

Definition at line 86 of file structuralConstraintPossibleEdges.cpp.

86 {
88 }

References StructuralConstraintPossibleEdges().

Here is the call graph for this function:

Member Function Documentation

◆ addEdge()

void gum::learning::StructuralConstraintPossibleEdges::addEdge ( const Edge & edge)

assign a new forbidden arc

◆ checkArcAdditionAlone()

bool gum::learning::StructuralConstraintPossibleEdges::checkArcAdditionAlone ( NodeId x,
NodeId y ) const

checks whether the constraints enable to add arc (x,y)

an arc can be added if and only if its extremal nodes belong to the graph and the arc does not already exist.

◆ checkArcDeletionAlone()

bool gum::learning::StructuralConstraintPossibleEdges::checkArcDeletionAlone ( NodeId x,
NodeId y ) const

checks whether the constraints enable to remove arc (x,y)

an arc can be removed if and only if the arc exists.

◆ checkArcReversalAlone()

bool gum::learning::StructuralConstraintPossibleEdges::checkArcReversalAlone ( NodeId x,
NodeId y ) const

checks whether the constraints enable to reverse arc (x,y)

an arc can be reversed if and only if it exists and arc (y,x) does not.

◆ checkModificationAlone() [1/4]

bool gum::learning::StructuralConstraintPossibleEdges::checkModificationAlone ( const ArcAddition & change) const

checks whether the constraints enable to add an arc

an arc can be added if and only if its extremal nodes belong to the graph and the arc does not already exist.

◆ checkModificationAlone() [2/4]

bool gum::learning::StructuralConstraintPossibleEdges::checkModificationAlone ( const ArcDeletion & change) const

checks whether the constraints enable to remove an arc

an arc can be removed if and only if the arc exists.

◆ checkModificationAlone() [3/4]

bool gum::learning::StructuralConstraintPossibleEdges::checkModificationAlone ( const ArcReversal & change) const

checks whether the constraints enable to reverse an arc

an arc (x,y) can be reversed if and only if it exists and arc (y,x) does not.

◆ checkModificationAlone() [4/4]

bool gum::learning::StructuralConstraintPossibleEdges::checkModificationAlone ( const GraphChange & change) const

checks whether the constraints enable to perform a graph change

An arc can be added if and only if its extremal nodes belong to the graph and the arc does not already exist. An arc can be removed if and only if the arc exists. An arc (x,y) can be reversed if and only if it exists and arc (y,x) does not.

◆ edges()

const EdgeSet & gum::learning::StructuralConstraintPossibleEdges::edges ( ) const

returns the set of mandatory arcs

◆ eraseEdge()

void gum::learning::StructuralConstraintPossibleEdges::eraseEdge ( const Edge & edge)

remove a forbidden arc

◆ isAlwaysInvalidAlone()

bool gum::learning::StructuralConstraintPossibleEdges::isAlwaysInvalidAlone ( const GraphChange & change) const

indicates whether a change will always violate the constraint

Some learning algorithms need examine several times whether a given graph change can be applied. For instance, the first time arc (X,Y) addition is considered, the learning algorithm may discard this change because it violates the structural constraint (e.g., if the latter enforces a DAG structure, this arc addition might induce a directed cycle), but, later on, other arc removal may induce that the arc addition is now possible. Such change is thus not always invalid. Conversely, there are changes that can be discarded once and for all. For instance, in a 2TBN structure, it is always impossible to add a backward-time arc. Such graph changes are always invalid and are therefore tagged as such by the isAlwaysInvalid method.

◆ modifyGraphAlone() [1/4]

void gum::learning::StructuralConstraintPossibleEdges::modifyGraphAlone ( const ArcAddition & change)

notify the constraint of a modification of the graph

Warning
If an already existing arc is added nothing is done. In particular, no exception is raised.
Exceptions
InvalidNodeexception is thrown if an arc (x,y) is added and x or y does not belong to the graph nodes

◆ modifyGraphAlone() [2/4]

void gum::learning::StructuralConstraintPossibleEdges::modifyGraphAlone ( const ArcDeletion & change)

notify the constraint of a modification of the graph

Warning
If a nonexisting arc is removed, nothing is done. In particular, no exception is raised.

◆ modifyGraphAlone() [3/4]

void gum::learning::StructuralConstraintPossibleEdges::modifyGraphAlone ( const ArcReversal & change)

notify the constraint of a modification of the graph

Warning
If an already existing arc is added, or if a nonexisting arc is removed, nothing is done. In particular, no exception is raised.
Exceptions
InvalidNodeexception is thrown if at least one extremity of the arc does not belong to the graph nodes

◆ modifyGraphAlone() [4/4]

void gum::learning::StructuralConstraintPossibleEdges::modifyGraphAlone ( const GraphChange & change)

notify the constraint of a modification of the graph

Warning
If an already existing arc is added, or if a nonexisting arc is removed, nothing is done. In particular, no exception is raised.
Exceptions
InvalidNodeexception is thrown if an arc (x,y) is added and x or y does not belong to the graph nodes

◆ operator=() [1/2]

StructuralConstraintPossibleEdges & gum::learning::StructuralConstraintPossibleEdges::operator= ( const StructuralConstraintPossibleEdges & from)

copy operator

Definition at line 91 of file structuralConstraintPossibleEdges.cpp.

92 {
93 if (this != &from) { _PossibleEdges_possible_edges_ = from._PossibleEdges_possible_edges_; }
94 return *this;
95 }

References StructuralConstraintPossibleEdges(), and _PossibleEdges_possible_edges_.

Here is the call graph for this function:

◆ operator=() [2/2]

StructuralConstraintPossibleEdges & gum::learning::StructuralConstraintPossibleEdges::operator= ( StructuralConstraintPossibleEdges && from)

move operator

Definition at line 99 of file structuralConstraintPossibleEdges.cpp.

99 {
100 if (this != &from) {
101 _PossibleEdges_possible_edges_ = std::move(from._PossibleEdges_possible_edges_);
102 }
103 return *this;
104 }

References StructuralConstraintPossibleEdges(), and _PossibleEdges_possible_edges_.

Here is the call graph for this function:

◆ setEdges()

void gum::learning::StructuralConstraintPossibleEdges::setEdges ( const EdgeSet & set)

assign a set of forbidden arcs

◆ setGraphAlone()

void gum::learning::StructuralConstraintPossibleEdges::setGraphAlone ( const DiGraph & graph)

sets a new graph from which we will perform checkings

Member Data Documentation

◆ _PossibleEdges_possible_edges_

EdgeSet gum::learning::StructuralConstraintPossibleEdges::_PossibleEdges_possible_edges_
protected

the PossibleEdges on which we perform checks

Definition at line 212 of file structuralConstraintPossibleEdges.h.

Referenced by StructuralConstraintPossibleEdges(), StructuralConstraintPossibleEdges(), operator=(), and operator=().


The documentation for this class was generated from the following files: