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

The class for notifying learning algorithms of new arc additions. More...

#include <graphChange.h>

Inheritance diagram for gum::learning::ArcAddition:
Collaboration diagram for gum::learning::ArcAddition:

Public Member Functions

Constructors / Destructors
 ArcAddition (NodeId node1, NodeId node2) noexcept
 default constructor
 ArcAddition (const ArcAddition &from) noexcept
 copy constructor
 ArcAddition (ArcAddition &&from) noexcept
 move constructor
 ~ArcAddition () noexcept
 destructor
Operators
ArcAdditionoperator= (const ArcAddition &from) noexcept
 copy constructor
ArcAdditionoperator= (ArcAddition &&from) noexcept
 move operator
bool operator== (const ArcAddition &from) const noexcept
 returns whether two arc additions are identical or not
bool operator!= (const ArcAddition &from) const noexcept
 returns whether two arc additions are different or not
Operators
bool operator== (const GraphChange &from) const noexcept
 returns whether two graph changes are identical or not
bool operator!= (const GraphChange &from) const noexcept
 returns whether two graph changes are different or not
Accessors/Modifiers
GraphChangeType type () const noexcept
 returns the type of the operation
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
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)
std::string toString () const
 put the content of the graph change into a string

Protected Attributes

LearnNodeId nodes_ [3]
 the nodes involved in the edge or arc to be modified
GraphChangeType type_
 the type of modification

Detailed Description

The class for notifying learning algorithms of new arc additions.

This class is convenient to know at compile time which graph change we are dealing with. Thus, this enables to perform faster code (we can avoid using a switch on GraphChanges to determine which change corresponds to this class.

Definition at line 209 of file graphChange.h.

Constructor & Destructor Documentation

◆ ArcAddition() [1/3]

gum::learning::ArcAddition::ArcAddition ( NodeId node1,
NodeId node2 )
noexcept

default constructor

References gum::learning::GraphChange::node1(), and gum::learning::GraphChange::node2().

Referenced by ArcAddition(), ArcAddition(), operator!=(), operator=(), operator=(), and operator==().

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

◆ ArcAddition() [2/3]

gum::learning::ArcAddition::ArcAddition ( const ArcAddition & from)
noexcept

copy constructor

References ArcAddition().

Here is the call graph for this function:

◆ ArcAddition() [3/3]

gum::learning::ArcAddition::ArcAddition ( ArcAddition && from)
noexcept

move constructor

References ArcAddition().

Here is the call graph for this function:

◆ ~ArcAddition()

gum::learning::ArcAddition::~ArcAddition ( )
noexcept

destructor

Member Function Documentation

◆ node1()

NodeId gum::learning::GraphChange::node1 ( ) const
noexceptinherited

returns the first node involved in the modification

References node1().

Referenced by gum::learning::ArcAddition::ArcAddition(), gum::learning::ArcDeletion::ArcDeletion(), gum::learning::ArcReversal::ArcReversal(), gum::learning::ArcTriangleDeletion1::ArcTriangleDeletion1(), gum::learning::ArcTriangleDeletion2::ArcTriangleDeletion2(), gum::learning::EdgeAddition::EdgeAddition(), gum::learning::EdgeDeletion::EdgeDeletion(), GraphChange(), gum::learning::StructuralConstraintDAG::checkModificationAlone(), gum::learning::StructuralConstraintDiGraph::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::checkModificationAlone(), gum::learning::StructuralConstraintIndegree::checkModificationAlone(), gum::learning::StructuralConstraintMandatoryArcs::checkModificationAlone(), gum::learning::StructuralConstraintNoChildrenNodes::checkModificationAlone(), gum::learning::StructuralConstraintNoParentNodes::checkModificationAlone(), gum::learning::StructuralConstraintPossibleEdges::checkModificationAlone(), gum::learning::StructuralConstraintSliceOrder::checkModificationAlone(), gum::learning::StructuralConstraintTabuList::checkModificationAlone(), gum::learning::StructuralConstraintTotalOrder::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintMandatoryArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintNoChildrenNodes::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintPossibleEdges::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintSliceOrder::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintTotalOrder::isAlwaysInvalidAlone(), node1(), and toString().

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

◆ node2()

NodeId gum::learning::GraphChange::node2 ( ) const
noexceptinherited

returns the second node involved in the modification

References node2().

Referenced by gum::learning::ArcAddition::ArcAddition(), gum::learning::ArcDeletion::ArcDeletion(), gum::learning::ArcReversal::ArcReversal(), gum::learning::ArcTriangleDeletion1::ArcTriangleDeletion1(), gum::learning::ArcTriangleDeletion2::ArcTriangleDeletion2(), gum::learning::EdgeAddition::EdgeAddition(), gum::learning::EdgeDeletion::EdgeDeletion(), GraphChange(), gum::learning::StructuralConstraintDAG::checkModificationAlone(), gum::learning::StructuralConstraintDiGraph::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::checkModificationAlone(), gum::learning::StructuralConstraintIndegree::checkModificationAlone(), gum::learning::StructuralConstraintMandatoryArcs::checkModificationAlone(), gum::learning::StructuralConstraintNoChildrenNodes::checkModificationAlone(), gum::learning::StructuralConstraintNoParentNodes::checkModificationAlone(), gum::learning::StructuralConstraintPossibleEdges::checkModificationAlone(), gum::learning::StructuralConstraintSliceOrder::checkModificationAlone(), gum::learning::StructuralConstraintTabuList::checkModificationAlone(), gum::learning::StructuralConstraintTotalOrder::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintMandatoryArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintNoChildrenNodes::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintPossibleEdges::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintSliceOrder::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintTotalOrder::isAlwaysInvalidAlone(), node2(), and toString().

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

◆ node3()

NodeId gum::learning::GraphChange::node3 ( ) const
inherited

returns the third node involved in the modification (if any)

Exceptions
InvalidNodeis raised if the modification does not involve a third

References node3(), and toString().

Referenced by GraphChange(), gum::learning::StructuralConstraintDAG::checkModificationAlone(), gum::learning::StructuralConstraintDiGraph::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::checkModificationAlone(), gum::learning::StructuralConstraintIndegree::checkModificationAlone(), gum::learning::StructuralConstraintMandatoryArcs::checkModificationAlone(), gum::learning::StructuralConstraintNoChildrenNodes::checkModificationAlone(), gum::learning::StructuralConstraintNoParentNodes::checkModificationAlone(), gum::learning::StructuralConstraintPossibleEdges::checkModificationAlone(), gum::learning::StructuralConstraintSliceOrder::checkModificationAlone(), gum::learning::StructuralConstraintTabuList::checkModificationAlone(), gum::learning::StructuralConstraintTotalOrder::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintMandatoryArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintNoChildrenNodes::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintPossibleEdges::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintSliceOrder::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintTotalOrder::isAlwaysInvalidAlone(), node3(), and toString().

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

◆ operator!=() [1/2]

bool gum::learning::ArcAddition::operator!= ( const ArcAddition & from) const
noexcept

returns whether two arc additions are different or not

References ArcAddition().

Here is the call graph for this function:

◆ operator!=() [2/2]

bool gum::learning::GraphChange::operator!= ( const GraphChange & from) const
noexceptinherited

returns whether two graph changes are different or not

References GraphChange().

Here is the call graph for this function:

◆ operator=() [1/2]

ArcAddition & gum::learning::ArcAddition::operator= ( ArcAddition && from)
noexcept

move operator

References ArcAddition().

Here is the call graph for this function:

◆ operator=() [2/2]

ArcAddition & gum::learning::ArcAddition::operator= ( const ArcAddition & from)
noexcept

copy constructor

References ArcAddition().

Here is the call graph for this function:

◆ operator==() [1/2]

bool gum::learning::ArcAddition::operator== ( const ArcAddition & from) const
noexcept

returns whether two arc additions are identical or not

References ArcAddition().

Here is the call graph for this function:

◆ operator==() [2/2]

bool gum::learning::GraphChange::operator== ( const GraphChange & from) const
noexceptinherited

returns whether two graph changes are identical or not

References GraphChange().

Here is the call graph for this function:

◆ toString()

std::string gum::learning::GraphChange::toString ( ) const
inherited

put the content of the graph change into a string

put the content of the GraphChange into a string

Definition at line 62 of file graphChange.cpp.

62 {
63 switch (type()) {
65 return std::format("ArcAddition ( {} , {} )", node1(), node2());
66
68 return std::format("ArcDeletion ( {} , {} )", node1(), node2());
69
71 return std::format("ArcReversal ( {} , {} )", node1(), node2());
72
74 return std::format("ArcTriangleDeletion1 ( {} , {} , {} )", node1(), node2(), node3());
75
77 return std::format("ArcTriangleDeletion2 ( {} , {} , {} )", node1(), node2(), node3());
78
80 return std::format("EdgeAddition ( {} , {} )", node1(), node2());
81
83 return std::format("EdgeDeletion ( {} , {} )", node1(), node2());
84 }
85
86 GUM_ERROR(OperationNotAllowed,
87 "Graph modification " << (int)type() << " is not supported yet in method toString")
88 }
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)
#define GUM_ERROR(type, msg)
Definition exceptions.h:76

References gum::learning::ARC_ADDITION, gum::learning::ARC_DELETION, gum::learning::ARC_REVERSAL, gum::learning::ARC_TRIANGLE_DELETION1, gum::learning::ARC_TRIANGLE_DELETION2, gum::learning::EDGE_ADDITION, gum::learning::EDGE_DELETION, GUM_ERROR, node1(), node2(), node3(), and type().

Referenced by node3(), and gum::learning::operator<<().

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

◆ type()

GraphChangeType gum::learning::GraphChange::type ( ) const
noexceptinherited

returns the type of the operation

References type(), and typeAsString().

Referenced by GraphChange(), gum::learning::StructuralConstraintDAG::checkModificationAlone(), gum::learning::StructuralConstraintDiGraph::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::checkModificationAlone(), gum::learning::StructuralConstraintIndegree::checkModificationAlone(), gum::learning::StructuralConstraintMandatoryArcs::checkModificationAlone(), gum::learning::StructuralConstraintNoChildrenNodes::checkModificationAlone(), gum::learning::StructuralConstraintNoParentNodes::checkModificationAlone(), gum::learning::StructuralConstraintPossibleEdges::checkModificationAlone(), gum::learning::StructuralConstraintSliceOrder::checkModificationAlone(), gum::learning::StructuralConstraintTabuList::checkModificationAlone(), gum::learning::StructuralConstraintTotalOrder::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintMandatoryArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintNoChildrenNodes::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintPossibleEdges::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintSliceOrder::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintTotalOrder::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintDAG::modifyGraphAlone(), gum::learning::StructuralConstraintDiGraph::modifyGraphAlone(), gum::learning::StructuralConstraintTabuList::modifyGraphAlone(), toString(), type(), and typeAsString().

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

◆ typeAsString()

std::string gum::learning::GraphChange::typeAsString ( ) const
inherited

returns a string corresponding to the type of the change

Definition at line 91 of file graphChange.cpp.

91 {
92 switch (type()) {
93 case GraphChangeType::ARC_ADDITION : return "ArcAddition";
94
95 case GraphChangeType::ARC_DELETION : return "ArcDeletion";
96
97 case GraphChangeType::ARC_REVERSAL : return "ArcReversal";
98
99 case GraphChangeType::ARC_TRIANGLE_DELETION1 : return "ArcTriangleDeletion1";
100
101 case GraphChangeType::ARC_TRIANGLE_DELETION2 : return "ArcTriangleDeletion2";
102
103 case GraphChangeType::EDGE_ADDITION : return "EdgeAddition";
104
105 case GraphChangeType::EDGE_DELETION : return "EdgeDeletion";
106 }
107
108 GUM_ERROR(OperationNotAllowed,
109 "Graph modification " << (int)type()
110 << " is not supported yet in method typeAsString")
111 }

References gum::learning::ARC_ADDITION, gum::learning::ARC_DELETION, gum::learning::ARC_REVERSAL, gum::learning::ARC_TRIANGLE_DELETION1, gum::learning::ARC_TRIANGLE_DELETION2, gum::learning::EDGE_ADDITION, gum::learning::EDGE_DELETION, GUM_ERROR, and type().

Referenced by gum::learning::StructuralConstraintDAG::checkModificationAlone(), gum::learning::StructuralConstraintDiGraph::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::checkModificationAlone(), gum::learning::StructuralConstraintIndegree::checkModificationAlone(), gum::learning::StructuralConstraintMandatoryArcs::checkModificationAlone(), gum::learning::StructuralConstraintPossibleEdges::checkModificationAlone(), gum::learning::StructuralConstraintTabuList::checkModificationAlone(), gum::learning::StructuralConstraintForbiddenArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintMandatoryArcs::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintPossibleEdges::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintSliceOrder::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintTotalOrder::isAlwaysInvalidAlone(), gum::learning::StructuralConstraintDAG::modifyGraphAlone(), gum::learning::StructuralConstraintDiGraph::modifyGraphAlone(), gum::learning::StructuralConstraintTabuList::modifyGraphAlone(), and type().

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

Member Data Documentation

◆ nodes_

LearnNodeId gum::learning::GraphChange::nodes_[3]
protectedinherited

the nodes involved in the edge or arc to be modified

Definition at line 175 of file graphChange.h.

◆ type_

GraphChangeType gum::learning::GraphChange::type_
protectedinherited

the type of modification

Definition at line 182 of file graphChange.h.

Referenced by HashFunc< ArcAddition >.


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