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

#include <graphChange.h>

Inheritance diagram for gum::learning::GraphChange:
[legend]

Public Member Functions

Operators
GraphChange & operator= (const GraphChange &from) noexcept
 copy constructor
GraphChange & operator= (GraphChange &&from) noexcept
 move operator
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

Friends

class HashFunc< GraphChange >
class HashFunc< ArcAddition >
class HashFunc< ArcDeletion >
class HashFunc< ArcReversal >
class HashFunc< ArcTriangleDeletion1 >
class HashFunc< ArcTriangleDeletion2 >
class HashFunc< EdgeAddition >
class HashFunc< EdgeDeletion >

Constructors / Destructors

 GraphChange (GraphChangeType type, NodeId node1, NodeId node2, NodeId node3=0) noexcept
 default constructor
 GraphChange (const GraphChange &from) noexcept
 copy constructor
 GraphChange (GraphChange &&from) noexcept
 move constructor
 ~GraphChange () noexcept
 destructor

Detailed Description

Definition at line 101 of file graphChange.h.

Constructor & Destructor Documentation

◆ GraphChange() [1/3]

gum::learning::GraphChange::GraphChange ( GraphChangeType type,
NodeId node1,
NodeId node2,
NodeId node3 = 0 )
protectednoexcept

default constructor

Definition at line 71 of file graphChange.cpp.

74 : type_{type} {
78 GUM_CONSTRUCTOR(GraphChange);
79 }
GraphChange(GraphChangeType type, NodeId node1, NodeId node2, NodeId node3=0) noexcept
default constructor
GraphChangeType type_
the type of modification
NodeId node1() const noexcept
returns the first node involved in the modification
GraphChangeType type() const noexcept
returns the type of the operation
LearnNodeId nodes_[3]
the nodes involved in the edge or arc to be modified
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)
uint32_t LearnNodeId
the internal type of the nodes involved in the arc/edge modifications
Definition graphChange.h:71

References node1(), node2(), node3(), type(), and type_.

Referenced by GraphChange(), GraphChange(), ~GraphChange(), HashFunc< ArcAddition >, operator!=(), operator=(), operator=(), and operator==().

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

◆ GraphChange() [2/3]

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

copy constructor

Definition at line 82 of file graphChange.cpp.

82 {
83 std::memcpy(nodes_, from.nodes_, 4 * sizeof(LearnNodeId));
84 GUM_CONS_CPY(GraphChange);
85 }

References GraphChange(), and nodes_.

Here is the call graph for this function:

◆ GraphChange() [3/3]

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

move constructor

Definition at line 88 of file graphChange.cpp.

88 {
89 std::memcpy(nodes_, from.nodes_, 4 * sizeof(LearnNodeId));
90 GUM_CONS_MOV(GraphChange);
91 }

References GraphChange(), and nodes_.

Here is the call graph for this function:

◆ ~GraphChange()

gum::learning::GraphChange::~GraphChange ( )
noexcept

destructor

Definition at line 94 of file graphChange.cpp.

94{ GUM_DESTRUCTOR(GraphChange); }

References GraphChange().

Here is the call graph for this function:

Member Function Documentation

◆ node1()

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

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
noexcept

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

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!=()

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

returns whether two graph changes are different or not

References GraphChange().

Here is the call graph for this function:

◆ operator=() [1/2]

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

copy constructor

copy operator

Definition at line 97 of file graphChange.cpp.

97 {
98 if (this != &from) { std::memcpy(nodes_, from.nodes_, 4 * sizeof(LearnNodeId)); }
99 return *this;
100 }

References GraphChange(), and nodes_.

Referenced by gum::learning::ArcAddition::operator=(), gum::learning::ArcDeletion::operator=(), gum::learning::ArcReversal::operator=(), gum::learning::ArcTriangleDeletion1::operator=(), gum::learning::ArcTriangleDeletion2::operator=(), gum::learning::EdgeAddition::operator=(), and gum::learning::EdgeDeletion::operator=().

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

◆ operator=() [2/2]

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

move operator

Definition at line 103 of file graphChange.cpp.

103 {
104 if (this != &from) { std::memcpy(nodes_, from.nodes_, 4 * sizeof(LearnNodeId)); }
105 return *this;
106 }

References GraphChange(), and nodes_.

Here is the call graph for this function:

◆ operator==()

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

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

put the content of the graph change into a string

put the content of the GraphChange into a string

Definition at line 273 of file graphChange.cpp.

273 {
274 switch (type()) {
276 return std::format("ArcAddition ( {} , {} )", node1(), node2());
277
279 return std::format("ArcDeletion ( {} , {} )", node1(), node2());
280
282 return std::format("ArcReversal ( {} , {} )", node1(), node2());
283
285 return std::format("ArcTriangleDeletion1 ( {} , {} , {} )", node1(), node2(), node3());
286
288 return std::format("ArcTriangleDeletion2 ( {} , {} , {} )", node1(), node2(), node3());
289
291 return std::format("EdgeAddition ( {} , {} )", node1(), node2());
292
294 return std::format("EdgeDeletion ( {} , {} )", node1(), node2());
295 }
296
297 GUM_ERROR(OperationNotAllowed,
298 "Graph modification " << (int)type() << " is not supported yet in method toString")
299 }
#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
noexcept

returns the type of the operation

References 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(), 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

returns a string corresponding to the type of the change

Definition at line 302 of file graphChange.cpp.

302 {
303 switch (type()) {
304 case GraphChangeType::ARC_ADDITION : return "ArcAddition";
305
306 case GraphChangeType::ARC_DELETION : return "ArcDeletion";
307
308 case GraphChangeType::ARC_REVERSAL : return "ArcReversal";
309
310 case GraphChangeType::ARC_TRIANGLE_DELETION1 : return "ArcTriangleDeletion1";
311
312 case GraphChangeType::ARC_TRIANGLE_DELETION2 : return "ArcTriangleDeletion2";
313
314 case GraphChangeType::EDGE_ADDITION : return "EdgeAddition";
315
316 case GraphChangeType::EDGE_DELETION : return "EdgeDeletion";
317 }
318
319 GUM_ERROR(OperationNotAllowed,
320 "Graph modification " << (int)type()
321 << " is not supported yet in method typeAsString")
322 }

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:

◆ HashFunc< ArcAddition >

friend class HashFunc< ArcAddition >
friend

Definition at line 182 of file graphChange.h.

References GraphChange(), and type_.

◆ HashFunc< ArcDeletion >

friend class HashFunc< ArcDeletion >
friend

Definition at line 182 of file graphChange.h.

◆ HashFunc< ArcReversal >

friend class HashFunc< ArcReversal >
friend

Definition at line 182 of file graphChange.h.

◆ HashFunc< ArcTriangleDeletion1 >

Definition at line 182 of file graphChange.h.

◆ HashFunc< ArcTriangleDeletion2 >

Definition at line 182 of file graphChange.h.

◆ HashFunc< EdgeAddition >

friend class HashFunc< EdgeAddition >
friend

Definition at line 182 of file graphChange.h.

◆ HashFunc< EdgeDeletion >

friend class HashFunc< EdgeDeletion >
friend

Definition at line 182 of file graphChange.h.

◆ HashFunc< GraphChange >

friend class HashFunc< GraphChange >
friend

Definition at line 182 of file graphChange.h.

Member Data Documentation

◆ nodes_

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

the nodes involved in the edge or arc to be modified

Definition at line 175 of file graphChange.h.

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

◆ type_

GraphChangeType gum::learning::GraphChange::type_
protected

the type of modification

Definition at line 182 of file graphChange.h.

Referenced by GraphChange(), and HashFunc< ArcAddition >.


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