GraphLibrary  0.0.1
A simple library that implements various graph algorithms.
 All Classes Namespaces Files Functions Variables Typedefs Macros
gl::Node< SCALAR > Class Template Reference

Represents a Node in a Graph. More...

#include <Node.hpp>

Public Types

using val_t = SCALAR
 Value type. More...
 
using idx_t = gl::index_type
 Index type. More...
 

Public Member Functions

 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.)
 
 Node (const Node< SCALAR > &)=default
 Copy constructor. More...
 
 Node (Node< SCALAR > &&) noexcept=default
 Move constructor. More...
 
Nodeoperator= (const Node< SCALAR > &)=default
 Copy assignment. More...
 
Nodeoperator= (Node< SCALAR > &&) noexcept=default
 Move assignment. More...
 
 ~Node ()=default
 Destructor. More...
 
bool operator== (const Node &rhs) const
 Check whether two nodes are equal. More...
 
bool operator!= (const Node &rhs) const
 Check whether two nodes are not equal. More...
 
id

Access to node ID.

idx_t id () const
 Checks whether an edge exists. More...
 
void id (const idx_t &id)
 Allows changing of node ID. More...
 
name

Access to the label of a node.

std::string label () const
 Gets the label of a node. More...
 
void label (const std::string &label)
 Allows changing the label of a node. More...
 
capacity

Access to capacity of the edge.

val_t capacity () const
 Gets the capacity of the node. More...
 
void capacity (const val_t &capacity)
 Allows changing the capacity of a node. More...
 
color

Access to the edge's RGBA color value.

Color color () const
 Gets the edge's color. More...
 
void color (const Color &color)
 Allows changing the edge's RGBA color value. More...
 
inDegree

Access to node in-degree.

idx_t inDegree () const
 Gets the in-degree of a node. More...
 
void inDegreeIncrement (const idx_t &increment=1)
 Increments the node in-degree. More...
 
void inDegreeDecrement (const idx_t &decrement=1)
 Decrements the node in-degree. More...
 
outDegree

Access to node out-degree.

idx_t outDegree () const
 Gets the out-degree of a node. More...
 
void outDegreeIncrement (const idx_t &increment=1)
 Increments the node out-degree. More...
 
void outDegreeDecrement (const idx_t &decrement=1)
 Decrements the node out-degree. More...
 
position

Access to node position.

std::pair< float, float > position () const
 Get Position of this node. More...
 
void position (const std::pair< float, float > &pos)
 Set Position of node. More...
 

Private Attributes

idx_t id_
 Node ID */. More...
 
std::string label_
 Node label */. More...
 
val_t capacity_
 Node capacity */. More...
 
Color color_
 Node color */. More...
 
idx_t inDegree_
 In-degree */. More...
 
idx_t outDegree_
 Out-degree */. More...
 
std::pair< float, float > position_
 Position of node. More...
 

Detailed Description

template<class SCALAR>
class gl::Node< SCALAR >

Represents a Node in a Graph.

Template Parameters
SCALARNumber type used to store node capacities.

Member Typedef Documentation

template<class SCALAR>
using gl::Node< SCALAR >::val_t = SCALAR

Value type.

template<class SCALAR>
using gl::Node< SCALAR >::idx_t = gl::index_type

Index type.

Constructor & Destructor Documentation

template<class SCALAR>
gl::Node< SCALAR >::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. 
)
inline
template<class SCALAR>
gl::Node< SCALAR >::Node ( const Node< SCALAR > &  )
default

Copy constructor.

template<class SCALAR>
gl::Node< SCALAR >::Node ( Node< SCALAR > &&  )
defaultnoexcept

Move constructor.

template<class SCALAR>
gl::Node< SCALAR >::~Node ( )
default

Destructor.

Member Function Documentation

template<class SCALAR>
Node& gl::Node< SCALAR >::operator= ( const Node< SCALAR > &  )
default

Copy assignment.

template<class SCALAR>
Node& gl::Node< SCALAR >::operator= ( Node< SCALAR > &&  )
defaultnoexcept

Move assignment.

template<class SCALAR >
bool gl::Node< SCALAR >::operator== ( const Node< SCALAR > &  rhs) const

Check whether two nodes are equal.

Returns
true if equal, false otherwise.
template<class SCALAR >
bool gl::Node< SCALAR >::operator!= ( const Node< SCALAR > &  rhs) const

Check whether two nodes are not equal.

Returns
true if not equal, false otherwise.
template<class SCALAR >
Node< SCALAR >::idx_t gl::Node< SCALAR >::id ( ) const
inline

Checks whether an edge exists.

Returns
True if exists, false otherwise.
template<class SCALAR >
void gl::Node< SCALAR >::id ( const idx_t id)
inline

Allows changing of node ID.

Parameters
[in]idNew value of node ID.
template<class SCALAR >
std::string gl::Node< SCALAR >::label ( ) const
inline

Gets the label of a node.

Returns
label of the node.
template<class SCALAR >
void gl::Node< SCALAR >::label ( const std::string &  label)
inline

Allows changing the label of a node.

Parameters
[in]labelNew value of node label.
template<class SCALAR >
Node< SCALAR >::val_t gl::Node< SCALAR >::capacity ( ) const
inline

Gets the capacity of the node.

Returns
Capacity of the node.
template<class SCALAR >
void gl::Node< SCALAR >::capacity ( const val_t capacity)
inline

Allows changing the capacity of a node.

Parameters
[in]capacityNew value of node capacity.
template<class SCALAR >
gl::Color gl::Node< SCALAR >::color ( ) const
inline

Gets the edge's color.

Returns
Color of the edge.
template<class SCALAR >
void gl::Node< SCALAR >::color ( const Color color)
inline

Allows changing the edge's RGBA color value.

Parameters
[in]colorNew color object.
template<class SCALAR >
Node< SCALAR >::idx_t gl::Node< SCALAR >::inDegree ( ) const
inline

Gets the in-degree of a node.

Returns
In-degree of a node.
template<class SCALAR >
void gl::Node< SCALAR >::inDegreeIncrement ( const idx_t increment = 1)
inline

Increments the node in-degree.

Parameters
[in]incrementnumber that will be added
template<class SCALAR >
void gl::Node< SCALAR >::inDegreeDecrement ( const idx_t decrement = 1)
inline

Decrements the node in-degree.

Parameters
[in]decrementnumber that will be subtracted
template<class SCALAR >
Node< SCALAR >::idx_t gl::Node< SCALAR >::outDegree ( ) const
inline

Gets the out-degree of a node.

Returns
Out-degree of a node.
template<class SCALAR >
void gl::Node< SCALAR >::outDegreeIncrement ( const idx_t increment = 1)
inline

Increments the node out-degree.

Parameters
[in]incrementnumber that will be added
template<class SCALAR >
void gl::Node< SCALAR >::outDegreeDecrement ( const idx_t decrement = 1)
inline

Decrements the node out-degree.

Parameters
[in]decrementnumber that will be subtracted
template<class SCALAR >
std::pair< float, float > gl::Node< SCALAR >::position ( ) const
inline

Get Position of this node.

Returns
Position of node
template<class SCALAR >
void gl::Node< SCALAR >::position ( const std::pair< float, float > &  pos)
inline

Set Position of node.

Parameters
posThe position of the node

Member Data Documentation

template<class SCALAR>
idx_t gl::Node< SCALAR >::id_
private

Node ID */.

template<class SCALAR>
std::string gl::Node< SCALAR >::label_
private

Node label */.

template<class SCALAR>
val_t gl::Node< SCALAR >::capacity_
private

Node capacity */.

template<class SCALAR>
Color gl::Node< SCALAR >::color_
private

Node color */.

template<class SCALAR>
idx_t gl::Node< SCALAR >::inDegree_
private

In-degree */.

template<class SCALAR>
idx_t gl::Node< SCALAR >::outDegree_
private

Out-degree */.

template<class SCALAR>
std::pair<float, float> gl::Node< SCALAR >::position_
private

Position of node.


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