![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
The base class for structural constraints used by learning algorithms that learn an undirected graph structure. More...
#include <structuralConstraintUndiGraph.h>
Public Types | |
| using | allConstraints = _ConstraintSet_< void > |
Public Member Functions | |
Constructors / Destructors | |
| StructuralConstraintUndiGraph () | |
| default constructor | |
| StructuralConstraintUndiGraph (Size nb_nodes) | |
| constructor starting with an empty graph with a given number of nodes | |
| StructuralConstraintUndiGraph (const UndiGraph &graph) | |
| constructor starting with a given graph | |
| StructuralConstraintUndiGraph (const StructuralConstraintUndiGraph &from) | |
| copy constructor | |
| StructuralConstraintUndiGraph (StructuralConstraintUndiGraph &&from) | |
| move constructor | |
| virtual | ~StructuralConstraintUndiGraph () |
| destructor | |
Operators | |
| StructuralConstraintUndiGraph & | operator= (const StructuralConstraintUndiGraph &from) |
| copy operator | |
| StructuralConstraintUndiGraph & | operator= (StructuralConstraintUndiGraph &&from) |
| move operator | |
Specific Accessors / Modifiers | |
| void | setGraph (Size nb_nodes) |
| sets a new empty graph from which we will perform checkings | |
| void | setGraphAlone (const UndiGraph &graph) |
| sets a new graph from which we will perform checkings | |
| void | modifyGraphAlone (const EdgeAddition &change) |
| notify the constraint of a modification of the graph | |
| void | modifyGraphAlone (const EdgeDeletion &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 | checkEdgeAdditionAlone (NodeId x, NodeId y) const |
| checks whether the constraints enable to add edge (x,y) | |
| bool | checkEdgeDeletionAlone (NodeId x, NodeId y) const |
| checks whether the constraints enable to remove edge (x,y) | |
| bool | checkModificationAlone (const GraphChange &change) const |
| checks whether the constraints enable to perform a graph change | |
| bool | checkModificationAlone (const EdgeAddition &change) const |
| checks whether the constraints enable to add an edge | |
| bool | checkModificationAlone (const EdgeDeletion &change) const |
| checks whether the constraints enable to remove an edge | |
Protected Attributes | |
| UndiGraph | _UndiGraph_graph_ |
| the UndiGraph on which we perform checks | |
The base class for structural constraints used by learning algorithms that learn an undirected graph structure.
This base should always be a virtual parent of the structural constraints classes. This will allow to combine different constraints into a single class
Definition at line 69 of file structuralConstraintUndiGraph.h.
|
inherited |
Definition at line 61 of file structuralConstraint.h.
| gum::learning::StructuralConstraintUndiGraph::StructuralConstraintUndiGraph | ( | ) |
default constructor
Definition at line 61 of file structuralConstraintUndiGraph.cpp.
References StructuralConstraintUndiGraph().
Referenced by StructuralConstraintUndiGraph(), StructuralConstraintUndiGraph(), StructuralConstraintUndiGraph(), StructuralConstraintUndiGraph(), StructuralConstraintUndiGraph(), ~StructuralConstraintUndiGraph(), operator=(), and operator=().
| gum::learning::StructuralConstraintUndiGraph::StructuralConstraintUndiGraph | ( | Size | nb_nodes | ) |
constructor starting with an empty graph with a given number of nodes
Definition at line 66 of file structuralConstraintUndiGraph.cpp.
References StructuralConstraintUndiGraph(), and setGraph().
| gum::learning::StructuralConstraintUndiGraph::StructuralConstraintUndiGraph | ( | const UndiGraph & | graph | ) |
constructor starting with a given graph
Definition at line 72 of file structuralConstraintUndiGraph.cpp.
References StructuralConstraintUndiGraph(), and setGraph().
| gum::learning::StructuralConstraintUndiGraph::StructuralConstraintUndiGraph | ( | const StructuralConstraintUndiGraph & | from | ) |
copy constructor
Definition at line 78 of file structuralConstraintUndiGraph.cpp.
References StructuralConstraintUndiGraph(), and _UndiGraph_graph_.
| gum::learning::StructuralConstraintUndiGraph::StructuralConstraintUndiGraph | ( | StructuralConstraintUndiGraph && | from | ) |
move constructor
Definition at line 84 of file structuralConstraintUndiGraph.cpp.
References StructuralConstraintUndiGraph(), and _UndiGraph_graph_.
|
virtual |
destructor
Definition at line 91 of file structuralConstraintUndiGraph.cpp.
References StructuralConstraintUndiGraph().
| bool gum::learning::StructuralConstraintUndiGraph::checkEdgeAdditionAlone | ( | NodeId | x, |
| NodeId | y ) const |
checks whether the constraints enable to add edge (x,y)
an arc can be added if and only if its extremal nodes belong to the graph and the edge does not already exist.
| bool gum::learning::StructuralConstraintUndiGraph::checkEdgeDeletionAlone | ( | NodeId | x, |
| NodeId | y ) const |
checks whether the constraints enable to remove edge (x,y)
an edge can be removed if and only if the edge exists.
| bool gum::learning::StructuralConstraintUndiGraph::checkModificationAlone | ( | const EdgeAddition & | change | ) | const |
checks whether the constraints enable to add an edge
an arc can be added if and only if its extremal nodes belong to the graph and the edge does not already exist.
| bool gum::learning::StructuralConstraintUndiGraph::checkModificationAlone | ( | const EdgeDeletion & | change | ) | const |
checks whether the constraints enable to remove an edge
an edge can be removed if and only if the edge exists.
| bool gum::learning::StructuralConstraintUndiGraph::checkModificationAlone | ( | const GraphChange & | change | ) | const |
checks whether the constraints enable to perform a graph change
An edge can be added if and only if its extremal nodes belong to the graph and the edge does not already exist. An edge can be removed if and only if the edge exists.
| bool gum::learning::StructuralConstraintUndiGraph::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 edge (X,Y) addition is considered, the learning algorithm may discard this change because it violates the structural constraint, but, later on, other edge removals may induce that the edge 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.
| void gum::learning::StructuralConstraintUndiGraph::modifyGraphAlone | ( | const EdgeAddition & | change | ) |
notify the constraint of a modification of the graph
| InvalidNode | exception is thrown if an edge (x,y) is added and x or y does not belong to the graph nodes |
| void gum::learning::StructuralConstraintUndiGraph::modifyGraphAlone | ( | const EdgeDeletion & | change | ) |
notify the constraint of a modification of the graph
| void gum::learning::StructuralConstraintUndiGraph::modifyGraphAlone | ( | const GraphChange & | change | ) |
notify the constraint of a modification of the graph
| InvalidNode | exception is thrown if an edge (x,y) is added and x or y does not belong to the graph nodes |
| StructuralConstraintUndiGraph & gum::learning::StructuralConstraintUndiGraph::operator= | ( | const StructuralConstraintUndiGraph & | from | ) |
copy operator
Definition at line 97 of file structuralConstraintUndiGraph.cpp.
References StructuralConstraintUndiGraph(), and _UndiGraph_graph_.
| StructuralConstraintUndiGraph & gum::learning::StructuralConstraintUndiGraph::operator= | ( | StructuralConstraintUndiGraph && | from | ) |
move operator
Definition at line 104 of file structuralConstraintUndiGraph.cpp.
References StructuralConstraintUndiGraph(), and _UndiGraph_graph_.
| void gum::learning::StructuralConstraintUndiGraph::setGraph | ( | Size | nb_nodes | ) |
sets a new empty graph from which we will perform checkings
Referenced by StructuralConstraintUndiGraph(), and StructuralConstraintUndiGraph().
| void gum::learning::StructuralConstraintUndiGraph::setGraphAlone | ( | const UndiGraph & | graph | ) |
sets a new graph from which we will perform checkings
|
protected |
the UndiGraph on which we perform checks
Definition at line 192 of file structuralConstraintUndiGraph.h.
Referenced by StructuralConstraintUndiGraph(), StructuralConstraintUndiGraph(), operator=(), and operator=().