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

Represents an Edge in a Graph. More...

#include <Edge.hpp>

Public Types

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

Public Member Functions

 Edge (const idx_t &src=0, const idx_t &dest=0, const val_t &weight=0, const Color &color=Color("black"), const bool &exists=false)
 Construct Edge from data. More...
 
 Edge (const Edge< SCALAR > &)=default
 Copy constructor. More...
 
 Edge (Edge< SCALAR > &&) noexcept=default
 Move constructor. More...
 
Edgeoperator= (const Edge< SCALAR > &)=default
 Copy assignment. More...
 
Edgeoperator= (Edge< SCALAR > &&) noexcept=default
 Move assignment. More...
 
 ~Edge ()=default
 Destructor. More...
 
bool operator== (const Edge &rhs) const
 Check whether two edges are equal. More...
 
bool operator!= (const Edge &rhs) const
 Check whether two edges are not equal. More...
 
exists

Access to boolean value exists. This signifies the existance of an edge in the graph.

bool exists () const
 Checks whether an edge exists. More...
 
void exists (bool exists)
 Allows changing of existance status of an edge. More...
 
source

Access to index of source node.

idx_t source () const
 Gets the index of the source of the edge. More...
 
void source (idx_t src)
 Allows changing the source of an edge. More...
 
dest

Access to index of destination node.

idx_t dest () const
 Gets the index of the destination of the edge. More...
 
void dest (idx_t dest)
 Allows changing the destination of an edge. More...
 
weight

Access to weight of the edge.

val_t weight () const
 Gets the weight of the edge. More...
 
void weight (val_t weight)
 Allows changing the weight of an edge. 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...
 

Private Attributes

idx_t src_
 Source index. More...
 
idx_t dest_
 Destination index. More...
 
val_t weight_
 Edge weight. More...
 
bool exists_
 Edge existance. More...
 
Color color_
 Edge color. More...
 

Detailed Description

template<class SCALAR = int>
class gl::Edge< SCALAR >

Represents an Edge in a Graph.

Template Parameters
SCALARNumber type used to store edge weights.

Member Typedef Documentation

template<class SCALAR = int>
using gl::Edge< SCALAR >::val_t = SCALAR

Value type.

template<class SCALAR = int>
using gl::Edge< SCALAR >::idx_t = gl::index_type

Index type.

Constructor & Destructor Documentation

template<class SCALAR = int>
gl::Edge< SCALAR >::Edge ( const idx_t src = 0,
const idx_t dest = 0,
const val_t weight = 0,
const Color color = Color("black"),
const bool &  exists = false 
)
inline

Construct Edge from data.

Parameters
[in]srcSource index
[in]destDestination index
[in]weightThe weight of the Edge
[in]colorColor of the Edge
[in]existsWhether the Edge exists
template<class SCALAR = int>
gl::Edge< SCALAR >::Edge ( const Edge< SCALAR > &  )
default

Copy constructor.

template<class SCALAR = int>
gl::Edge< SCALAR >::Edge ( Edge< SCALAR > &&  )
defaultnoexcept

Move constructor.

template<class SCALAR = int>
gl::Edge< SCALAR >::~Edge ( )
default

Destructor.

Member Function Documentation

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

Copy assignment.

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

Move assignment.

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

Check whether two edges are equal.

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

Check whether two edges are not equal.

Returns
true if not equal, false otherwise.
template<class SCALAR >
bool gl::Edge< SCALAR >::exists ( ) const
inline

Checks whether an edge exists.

Returns
True if exists, false otherwise.
template<class SCALAR >
void gl::Edge< SCALAR >::exists ( bool  exists)
inline

Allows changing of existance status of an edge.

Parameters
[in]existsNew value of boolean exists.
template<class SCALAR >
Edge< SCALAR >::idx_t gl::Edge< SCALAR >::source ( ) const
inline

Gets the index of the source of the edge.

Returns
index of edge source node.
template<class SCALAR >
void gl::Edge< SCALAR >::source ( idx_t  src)
inline

Allows changing the source of an edge.

Parameters
[in]srcNew value of source index.
template<class SCALAR >
Edge< SCALAR >::idx_t gl::Edge< SCALAR >::dest ( ) const
inline

Gets the index of the destination of the edge.

Returns
index of edge destination node.
template<class SCALAR >
void gl::Edge< SCALAR >::dest ( idx_t  dest)
inline

Allows changing the destination of an edge.

Parameters
[in]destNew value of destination index.
template<class SCALAR >
Edge< SCALAR >::val_t gl::Edge< SCALAR >::weight ( ) const
inline

Gets the weight of the edge.

Returns
Weight of the edge.
template<class SCALAR >
void gl::Edge< SCALAR >::weight ( val_t  weight)
inline

Allows changing the weight of an edge.

Parameters
[in]weightNew value of edge weight.
template<class SCALAR >
gl::Color gl::Edge< SCALAR >::color ( ) const
inline

Gets the edge's color.

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

Allows changing the edge's RGBA color value.

Parameters
[in]colorNew color object.

Member Data Documentation

template<class SCALAR = int>
idx_t gl::Edge< SCALAR >::src_
private

Source index.

template<class SCALAR = int>
idx_t gl::Edge< SCALAR >::dest_
private

Destination index.

template<class SCALAR = int>
val_t gl::Edge< SCALAR >::weight_
private

Edge weight.

template<class SCALAR = int>
bool gl::Edge< SCALAR >::exists_
private

Edge existance.

template<class SCALAR = int>
Color gl::Edge< SCALAR >::color_
private

Edge color.


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