aGrUM  0.20.3
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 More...
 
 GraphChange (const GraphChange &from) noexcept
 copy constructor More...
 
 GraphChange (GraphChange &&from) noexcept
 move constructor More...
 
 ~GraphChange () noexcept
 destructor More...
 
Operators
GraphChangeoperator= (const GraphChange &from) noexcept
 copy constructor More...
 
GraphChangeoperator= (GraphChange &&from) noexcept
 move operator More...
 
bool operator== (const GraphChange &from) const noexcept
 returns whether two graph changes are identical or not More...
 
bool operator!= (const GraphChange &from) const noexcept
 returns whether two graph changes are different or not More...
 
Accessors/Modifiers
GraphChangeType type () const noexcept
 returns the type of the operation More...
 
NodeId node1 () const noexcept
 returns the first node involved in the modification More...
 
NodeId node2 () const noexcept
 returns the second node involved in the modification More...
 
virtual std::string toString () const
 put the content of the graph change into a string More...
 

Detailed Description

Definition at line 65 of file graphChange.h.

Constructor & Destructor Documentation

◆ GraphChange() [1/3]

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

default constructor

◆ GraphChange() [2/3]

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

copy constructor

◆ GraphChange() [3/3]

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

move constructor

◆ ~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

◆ node2()

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

returns the second node involved in the modification

◆ operator!=()

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

returns whether two graph changes are different or not

◆ operator=() [1/2]

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

copy constructor

◆ operator=() [2/2]

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

move operator

◆ operator==()

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

returns whether two graph changes are identical or not

◆ 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::EdgeDeletion, gum::learning::EdgeAddition, gum::learning::ArcReversal, gum::learning::ArcDeletion, and gum::learning::ArcAddition.

Definition at line 42 of file graphChange.cpp.

References gum::learning::genericBNLearner::Database::Database().

42  {
43  std::stringstream stream;
44  switch (type()) {
46  stream << "ArcAddition ( " << node1() << " , " << node2() << " )";
47  return stream.str();
48 
50  stream << "ArcDeletion ( " << node1() << " , " << node2() << " )";
51  return stream.str();
52 
54  stream << "ArcReversal ( " << node1() << " , " << node2() << " )";
55  return stream.str();
56 
58  stream << "EdgeAddition ( " << node1() << " , " << node2() << " )";
59  return stream.str();
60 
62  stream << "EdgeDeletion ( " << node1() << " , " << node2() << " )";
63  return stream.str();
64 
65  default:
66  GUM_ERROR(OperationNotAllowed, "this graph modification is not supported yet")
67  }
68  }
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:51
NodeId node1() const noexcept
returns the first node involved in the modification
+ Here is the call graph for this function:

◆ type()

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

returns the type of the operation

Member Data Documentation

◆ _node1_

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

the first node in the edge or arc to be modified

Definition at line 129 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 132 of file graphChange.h.

◆ _type_

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

the type of modification

Definition at line 126 of file graphChange.h.


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