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

#include <graphChange.h>

Inheritance diagram for gum::learning::GraphChange:

Public Member Functions

Constructors / Destructors
 GraphChange (GraphChangeType type, NodeId node1, NodeId node2) noexcept
 default constructor
 GraphChange (const GraphChange &from) noexcept
 copy constructor
 GraphChange (GraphChange &&from) noexcept
 move constructor
 ~GraphChange () noexcept
 destructor
Operators
GraphChangeoperator= (const GraphChange &from) noexcept
 copy constructor
GraphChangeoperator= (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
NodeId node1 () const noexcept
 returns the first node involved in the modification
NodeId node2 () const noexcept
 returns the second node involved in the modification
virtual std::string toString () const
 put the content of the graph change into a string

Private Attributes

GraphChangeType _type_
 the type of modification
NodeId _node1_
 the first node in the edge or arc to be modified
NodeId _node2_
 the second node in the edge or arc to be modified

Detailed Description

Definition at line 78 of file graphChange.h.

Constructor & Destructor Documentation

◆ GraphChange() [1/3]

gum::learning::GraphChange::GraphChange ( GraphChangeType type,
NodeId node1,
NodeId node2 )
noexcept

default constructor

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

Referenced by GraphChange(), GraphChange(), gum::learning::EdgeDeletion::operator!=(), 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

References GraphChange().

Here is the call graph for this function:

◆ GraphChange() [3/3]

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

move constructor

References GraphChange().

Here is the call graph for this function:

◆ ~GraphChange()

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

destructor

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::EdgeAddition::EdgeAddition(), gum::learning::EdgeDeletion::EdgeDeletion(), GraphChange(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), node1(), gum::learning::ArcAddition::toString(), gum::learning::ArcDeletion::toString(), gum::learning::ArcReversal::toString(), gum::learning::EdgeAddition::toString(), gum::learning::EdgeDeletion::toString(), 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(), and toString().

Referenced by gum::learning::ArcAddition::ArcAddition(), gum::learning::ArcDeletion::ArcDeletion(), gum::learning::ArcReversal::ArcReversal(), gum::learning::EdgeAddition::EdgeAddition(), gum::learning::EdgeDeletion::EdgeDeletion(), GraphChange(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), node2(), gum::learning::ArcAddition::toString(), gum::learning::ArcDeletion::toString(), gum::learning::ArcReversal::toString(), gum::learning::EdgeAddition::toString(), gum::learning::EdgeDeletion::toString(), 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

References GraphChange().

Here is the call graph for this function:

◆ operator=() [2/2]

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

move operator

References GraphChange().

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
virtual

put the content of the graph change into a string

put the content of the GraphChange into a string

Reimplemented in gum::learning::ArcAddition, gum::learning::ArcDeletion, gum::learning::ArcReversal, gum::learning::EdgeAddition, and gum::learning::EdgeDeletion.

Definition at line 62 of file graphChange.cpp.

62 {
63 std::stringstream stream;
64 switch (type()) {
66 stream << "ArcAddition ( " << node1() << " , " << node2() << " )";
67 return stream.str();
68
70 stream << "ArcDeletion ( " << node1() << " , " << node2() << " )";
71 return stream.str();
72
74 stream << "ArcReversal ( " << node1() << " , " << node2() << " )";
75 return stream.str();
76
78 stream << "EdgeAddition ( " << node1() << " , " << node2() << " )";
79 return stream.str();
80
82 stream << "EdgeDeletion ( " << node1() << " , " << node2() << " )";
83 return stream.str();
84
85 default : GUM_ERROR(OperationNotAllowed, "this graph modification is not supported yet")
86 }
87 }
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
#define GUM_ERROR(type, msg)
Definition exceptions.h:72

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

Referenced by node2(), 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 type().

Referenced by GraphChange(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), toString(), and type().

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

Member Data Documentation

◆ _node1_

NodeId gum::learning::GraphChange::_node1_
private

the first node in the edge or arc to be modified

Definition at line 142 of file graphChange.h.

◆ _node2_

NodeId gum::learning::GraphChange::_node2_
private

the second node in the edge or arc to be modified

Definition at line 145 of file graphChange.h.

◆ _type_

GraphChangeType gum::learning::GraphChange::_type_
private

the type of modification

Definition at line 139 of file graphChange.h.


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