![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
the class for structural constraints limiting the number of parents of nodes in a directed graph More...
#include <structuralConstraintIndegree.h>
Public Member Functions | |
Constructors / Destructors | |
| StructuralConstraintIndegree () | |
| default constructor | |
| StructuralConstraintIndegree (Size nb_nodes, Size max_indegree) | |
| constructor starting with an empty graph with a given number of nodes | |
| StructuralConstraintIndegree (const DiGraph &graph, Size max_indegree) | |
| constructor starting with a given graph | |
| StructuralConstraintIndegree (const StructuralConstraintIndegree &from) | |
| copy constructor | |
| StructuralConstraintIndegree (StructuralConstraintIndegree &&from) | |
| move constructor | |
| virtual | ~StructuralConstraintIndegree () |
| destructor | |
Operators | |
| StructuralConstraintIndegree & | operator= (const StructuralConstraintIndegree &from) |
| copy operator | |
| StructuralConstraintIndegree & | operator= (StructuralConstraintIndegree &&from) |
| move operator | |
Specific Accessors / Modifiers | |
| void | setIndegree (const NodeProperty< Size > &max_indegree) |
| sets the default max indegree for all the nodes in the property | |
| void | setMaxIndegree (Size max_indegree, bool update_all_node=false) |
| resets the default max indegree and possibly updates the indegree of all nodes | |
| 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 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 | |
| bool | checkModificationAlone (const GraphChange &change) const |
| checks whether the constraints enable to perform a graph change | |
| Size | maxIndegree () const |
| sets the default max indegree for all the nodes in the property | |
Protected Types | |
| using | constraints |
Protected Member Functions | |
Accessors / Modifiers | |
| void | setGraph (const DiGraph &graph) |
| sets a new graph from which we will perform checkings | |
| void | modifyGraph (const ArcAddition &change) |
| notify the constraint of a modification of the graph | |
| bool | isAlwaysInvalid (const GraphChange &change) const |
| indicates whether a change will always violate the constraint | |
| bool | checkArcAddition (NodeId x, NodeId y) const |
| checks whether the constraints enable to add arc (x,y) | |
| bool | checkArcDeletion (NodeId x, NodeId y) const |
| checks whether the constraints enable to remove arc (x,y) | |
| bool | checkArcReversal (NodeId x, NodeId y) const |
| checks whether the constraints enable to reverse arc (x,y) | |
| bool | checkModification (const ArcAddition &change) const |
| checks whether the constraints enable to add an arc | |
Protected Attributes | |
| NodeProperty< Size > | _Indegree_max_parents_ |
| the max number of parents per node | |
| Size | _Indegree_max_indegree_ {std::numeric_limits< Size >::max()} |
| a default max indegree to assign for nodes without specified indegree | |
the class for structural constraints limiting the number of parents of nodes in a directed graph
Definition at line 68 of file structuralConstraintIndegree.h.
|
inherited |
Definition at line 425 of file structuralConstraintSetStatic.h.
| gum::learning::StructuralConstraintIndegree::StructuralConstraintIndegree | ( | ) |
default constructor
Definition at line 61 of file structuralConstraintIndegree.cpp.
References StructuralConstraintIndegree().
Referenced by StructuralConstraintIndegree(), StructuralConstraintIndegree(), StructuralConstraintIndegree(), StructuralConstraintIndegree(), StructuralConstraintIndegree(), ~StructuralConstraintIndegree(), operator=(), and operator=().
| gum::learning::StructuralConstraintIndegree::StructuralConstraintIndegree | ( | Size | nb_nodes, |
| Size | max_indegree ) |
constructor starting with an empty graph with a given number of nodes
Definition at line 66 of file structuralConstraintIndegree.cpp.
References StructuralConstraintIndegree(), _Indegree_max_indegree_, and _Indegree_max_parents_.
| gum::learning::StructuralConstraintIndegree::StructuralConstraintIndegree | ( | const DiGraph & | graph, |
| Size | max_indegree ) |
constructor starting with a given graph
Definition at line 75 of file structuralConstraintIndegree.cpp.
References StructuralConstraintIndegree(), _Indegree_max_indegree_, and _Indegree_max_parents_.
| gum::learning::StructuralConstraintIndegree::StructuralConstraintIndegree | ( | const StructuralConstraintIndegree & | from | ) |
copy constructor
Definition at line 85 of file structuralConstraintIndegree.cpp.
References StructuralConstraintIndegree(), _Indegree_max_indegree_, and _Indegree_max_parents_.
| gum::learning::StructuralConstraintIndegree::StructuralConstraintIndegree | ( | StructuralConstraintIndegree && | from | ) |
move constructor
Definition at line 93 of file structuralConstraintIndegree.cpp.
References StructuralConstraintIndegree(), _Indegree_max_indegree_, and _Indegree_max_parents_.
|
virtual |
destructor
Definition at line 102 of file structuralConstraintIndegree.cpp.
References StructuralConstraintIndegree().
|
inherited |
checks whether the constraints enable to add arc (x,y)
| bool gum::learning::StructuralConstraintIndegree::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 and its addition would not violate the indegree constraint of y.
|
inherited |
checks whether the constraints enable to remove arc (x,y)
| bool gum::learning::StructuralConstraintIndegree::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.
|
inherited |
checks whether the constraints enable to reverse arc (x,y)
| bool gum::learning::StructuralConstraintIndegree::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 and its addition would not violate the indegree constraint of x.
|
inherited |
checks whether the constraints enable to add an arc
| bool gum::learning::StructuralConstraintIndegree::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 and its addition would not violate the indegree constraint of y.
| bool gum::learning::StructuralConstraintIndegree::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.
| bool gum::learning::StructuralConstraintIndegree::checkModificationAlone | ( | const ArcReversal & | change | ) | const |
checks whether the constraints enable to reverse an arc
an arc can be reversed if and only if it exists and arc (y,x) does not and its addition would not violate the indegree constraint of x.
| bool gum::learning::StructuralConstraintIndegree::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 and its addition would not violate the indegree constraint of y. An arc can be removed if and only if the arc exists. An arc can be reversed if and only if it exists and arc (y,x) does not and its addition would not violate the indegree constraint of x.
|
inherited |
indicates whether a change will always violate the constraint
| bool gum::learning::StructuralConstraintIndegree::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.
|
inline |
sets the default max indegree for all the nodes in the property
Definition at line 214 of file structuralConstraintIndegree.h.
References _Indegree_max_indegree_.
|
inherited |
notify the constraint of a modification of the graph
| void gum::learning::StructuralConstraintIndegree::modifyGraphAlone | ( | const ArcAddition & | change | ) |
notify the constraint of a modification of the graph
| InvalidNode | exception is thrown if an arc (x,y) is added and x or y does not belong to the graph nodes |
| OutOfBounds | exception is thrown if the indegree constraint is violated by the arc addition. |
| void gum::learning::StructuralConstraintIndegree::modifyGraphAlone | ( | const ArcDeletion & | change | ) |
notify the constraint of a modification of the graph
| void gum::learning::StructuralConstraintIndegree::modifyGraphAlone | ( | const ArcReversal & | change | ) |
notify the constraint of a modification of the graph
| InvalidNode | exception is thrown if an arc (x,y) is added and x or y does not belong to the graph nodes |
| OutOfBounds | exception is thrown if the indegree constraint is violated by the arc reversal. |
| void gum::learning::StructuralConstraintIndegree::modifyGraphAlone | ( | const GraphChange & | change | ) |
notify the constraint of a modification of the graph
| InvalidNode | exception is thrown if an arc (x,y) is added and x or y does not belong to the graph nodes |
| OutOfBounds | exception is thrown if the indegree constraint is violated by an arc addition or reversal. |
| StructuralConstraintIndegree & gum::learning::StructuralConstraintIndegree::operator= | ( | const StructuralConstraintIndegree & | from | ) |
copy operator
Definition at line 108 of file structuralConstraintIndegree.cpp.
References StructuralConstraintIndegree(), _Indegree_max_indegree_, _Indegree_max_parents_, and gum::learning::StructuralConstraintDiGraph::operator=().
| StructuralConstraintIndegree & gum::learning::StructuralConstraintIndegree::operator= | ( | StructuralConstraintIndegree && | from | ) |
move operator
Definition at line 120 of file structuralConstraintIndegree.cpp.
References StructuralConstraintIndegree(), _Indegree_max_indegree_, _Indegree_max_parents_, and gum::learning::StructuralConstraintDiGraph::operator=().
|
inherited |
sets a new graph from which we will perform checkings
| void gum::learning::StructuralConstraintIndegree::setGraphAlone | ( | const DiGraph & | graph | ) |
sets a new graph from which we will perform checkings
| void gum::learning::StructuralConstraintIndegree::setIndegree | ( | const NodeProperty< Size > & | max_indegree | ) |
sets the default max indegree for all the nodes in the property
| void gum::learning::StructuralConstraintIndegree::setMaxIndegree | ( | Size | max_indegree, |
| bool | update_all_node = false ) |
resets the default max indegree and possibly updates the indegree of all nodes
|
protected |
a default max indegree to assign for nodes without specified indegree
Definition at line 232 of file structuralConstraintIndegree.h.
Referenced by StructuralConstraintIndegree(), StructuralConstraintIndegree(), StructuralConstraintIndegree(), StructuralConstraintIndegree(), maxIndegree(), operator=(), and operator=().
|
protected |
the max number of parents per node
Definition at line 229 of file structuralConstraintIndegree.h.
Referenced by StructuralConstraintIndegree(), StructuralConstraintIndegree(), StructuralConstraintIndegree(), StructuralConstraintIndegree(), operator=(), and operator=().