aGrUM  0.16.0
graphChange.cpp
Go to the documentation of this file.
1 
33 
34 #ifdef GUM_NO_INLINE
36 #endif // GUM_NOINLINE
37 
38 namespace gum {
39 
40  namespace learning {
41 
43  std::string GraphChange::toString() const {
44  std::stringstream stream;
45  switch (type()) {
47  stream << "ArcAddition ( " << node1() << " , " << node2() << " )";
48  return stream.str();
49 
51  stream << "ArcDeletion ( " << node1() << " , " << node2() << " )";
52  return stream.str();
53 
55  stream << "ArcReversal ( " << node1() << " , " << node2() << " )";
56  return stream.str();
57 
59  stream << "EdgeAddition ( " << node1() << " , " << node2() << " )";
60  return stream.str();
61 
63  stream << "EdgeDeletion ( " << node1() << " , " << node2() << " )";
64  return stream.str();
65 
66  default:
68  "this graph modification is not supported yet");
69  }
70  }
71 
73  std::string ArcAddition::toString() const {
74  std::stringstream stream;
75  stream << "ArcAddition ( " << node1() << " , " << node2() << " )";
76  return stream.str();
77  }
78 
80  std::string ArcDeletion::toString() const {
81  std::stringstream stream;
82  stream << "ArcDeletion ( " << node1() << " , " << node2() << " )";
83  return stream.str();
84  }
85 
87  std::string ArcReversal::toString() const {
88  std::stringstream stream;
89  stream << "ArcReversal ( " << node1() << " , " << node2() << " )";
90  return stream.str();
91  }
92 
94  std::string EdgeAddition::toString() const {
95  std::stringstream stream;
96  stream << "EdgeAddition ( " << node1() << " , " << node2() << " )";
97  return stream.str();
98  }
99 
101  std::string EdgeDeletion::toString() const {
102  std::stringstream stream;
103  stream << "EdgeDeletion ( " << node1() << " , " << node2() << " )";
104  return stream.str();
105  }
106 
108  std::ostream& operator<<(std::ostream& stream, const GraphChange& change) {
109  return stream << change.toString();
110  }
111 
113  std::ostream& operator<<(std::ostream& stream, const ArcAddition& change) {
114  return stream << change.toString();
115  }
116 
118  std::ostream& operator<<(std::ostream& stream, const ArcDeletion& change) {
119  return stream << change.toString();
120  }
121 
123  std::ostream& operator<<(std::ostream& stream, const ArcReversal& change) {
124  return stream << change.toString();
125  }
126 
128  std::ostream& operator<<(std::ostream& stream, const EdgeAddition& change) {
129  return stream << change.toString();
130  }
131 
133  std::ostream& operator<<(std::ostream& stream, const EdgeDeletion& change) {
134  return stream << change.toString();
135  }
136 
137  } /* namespace learning */
138 
139 } /* namespace gum */
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
The class for notifying learning algorithms of new arc additionsThis class is convenient to know at c...
Definition: graphChange.h:150
The class for notifying learning algorithms of arc removalsThis class is convenient to know at compil...
Definition: graphChange.h:216
std::ostream & operator<<(std::ostream &stream, const IdSet< ALLOC > &idset)
the display operator
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
The class for notifying learning algorithms of edge removalsThis class is convenient to know at compi...
Definition: graphChange.h:414
virtual std::string toString() const final
put the content of the EdgeAddition into a string
Definition: graphChange.cpp:94
virtual std::string toString() const final
put the content of the EdgeDeletion into a string
The class for notifying learning algorithms of new edge additionsThis class is convenient to know at ...
Definition: graphChange.h:348
GraphChangeType type() const noexcept
returns the type of the operation
NodeId node2() const noexcept
returns the second node involved in the modification
virtual std::string toString() const final
put the content of the ArcReversal into a string
Definition: graphChange.cpp:87
virtual std::string toString() const
put the content of the graph change into a string
Definition: graphChange.cpp:43
The class for notifying learning algorithms of arc reversalsThis class is convenient to know at compi...
Definition: graphChange.h:282
virtual std::string toString() const final
put the content of the ArcDeletion into a string
Definition: graphChange.cpp:80
virtual std::string toString() const final
put the content of the ArcAddition into a string
Definition: graphChange.cpp:73
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
NodeId node1() const noexcept
returns the first node involved in the modification