17 template <
class SCALAR>
30 Node &operator=(const
Node<SCALAR>&) = default;
31 Node &operator=(
Node<SCALAR>&&) noexcept = default;
38 bool operator== (const
Node& rhs) const;
43 bool operator!= (const
Node& rhs) const;
54 inline
idx_t id() const;
59 inline
void id(const
idx_t &
id);
70 inline std::
string label() const;
160 inline std::pair<
float,
float>
position() const;
165 inline
void position(const std::pair<
float,
float> &pos);
183 template <class SCALAR>
184 bool Node<SCALAR>::operator== (const
Node<SCALAR>& rhs)
const
186 return id_ == rhs.
id_
187 && label_ == rhs.label_
188 && capacity_ == rhs.capacity_
189 && color_ == rhs.color_
190 && inDegree_ == rhs.inDegree_
191 && outDegree_ == rhs.outDegree_
192 && position_ == rhs.position_;
195 template <
class SCALAR>
202 template <
class SCALAR>
208 template <
class SCALAR>
215 template <
class SCALAR>
221 template <
class SCALAR>
228 template <
class SCALAR>
234 template <
class SCALAR>
241 template <
class SCALAR>
247 template <
class SCALAR>
253 template <
class SCALAR>
256 GL_ASSERT(decrement <=
inDegree_,
"Node::inDegreeDecrement | Decrement results in negative inDegree")
261 template <
class SCALAR>
267 template <
class SCALAR>
273 template <
class SCALAR>
276 GL_ASSERT(decrement <=
outDegree_,
"Node::outDegreeDecrement | Decrement results in negative outDegree")
281 template <
class SCALAR>
287 template <
class SCALAR>
294 template <
class SCALAR>
300 template <
class SCALAR>
308 #endif // GL_NODE_HPP
idx_t inDegree() const
Gets the in-degree of a node.
Definition: Node.hpp:242
Node(const idx_t &id=0, const val_t &capacity=1, const gl::Color &color=Color("white"), const std::string &label="", const float &x=0., const float &y=0.)
Definition: Node.hpp:24
bool operator!=(const Node &rhs) const
Check whether two nodes are not equal.
Definition: Node.hpp:196
std::pair< float, float > position() const
Get Position of this node.
Definition: Node.hpp:295
Stores an RGBA Color.
Definition: Color.hpp:21
idx_t inDegree_
In-degree */.
Definition: Node.hpp:173
val_t capacity_
Node capacity */.
Definition: Node.hpp:171
bool operator==(const Node &rhs) const
Check whether two nodes are equal.
Definition: Node.hpp:184
idx_t id_
Node ID */.
Definition: Node.hpp:169
void inDegreeDecrement(const idx_t &decrement=1)
Decrements the node in-degree.
Definition: Node.hpp:254
idx_t outDegree() const
Gets the out-degree of a node.
Definition: Node.hpp:262
Represents a Node in a Graph.
Definition: Node.hpp:18
Color color() const
Gets the edge's color.
Definition: Node.hpp:282
std::string label_
Node label */.
Definition: Node.hpp:170
SCALAR val_t
Value type.
Definition: Node.hpp:21
#define GL_ASSERT(EXPR, ERROR_MSG)
Custom assert that supports attaching a message.
Definition: gl_assert.hpp:14
val_t capacity() const
Gets the capacity of the node.
Definition: Node.hpp:229
void outDegreeDecrement(const idx_t &decrement=1)
Decrements the node out-degree.
Definition: Node.hpp:274
std::size_t index_type
Definition: gl_base.hpp:18
idx_t id() const
Checks whether an edge exists.
Definition: Node.hpp:203
std::pair< float, float > position_
Position of node.
Definition: Node.hpp:175
void outDegreeIncrement(const idx_t &increment=1)
Increments the node out-degree.
Definition: Node.hpp:268
idx_t outDegree_
Out-degree */.
Definition: Node.hpp:174
Color color_
Node color */.
Definition: Node.hpp:172
std::string label() const
Gets the label of a node.
Definition: Node.hpp:216
gl::index_type idx_t
Index type.
Definition: Node.hpp:22
void inDegreeIncrement(const idx_t &increment=1)
Increments the node in-degree.
Definition: Node.hpp:248