Evoplex  0.2.1
Public Member Functions | Friends | List of all members
evoplex::Node Class Reference

It wraps a std::shared_ptr<BaseNode>. More...

#include <node.h>

Public Member Functions

 Node (NodePtr node)
 Constructor. More...
 
 Node (const std::pair< const int, Node > &p)
 Constructor to ease range-based for loops. More...
 
 Node (const std::pair< const int, Edge > &p)
 Constructor to ease range-based for loops. More...
 
 Node ()
 Constructor.
 
Nodeoperator= (const Node &n)
 Sets the current node to n.
 
bool operator== (const Node &n) const
 Checks if n and the current Node point to the same BaseNode.
 
bool operator!= (const Node &n) const
 Checks if n and the current Node point to the same BaseNode.
 
bool isNull () const
 Checks if the current Node is null.
 
NodePtr clone () const
 Creates a new std::shared_ptr<BaseNode> with the same data of the current Node. More...
 
int id () const
 Gets the node's id. More...
 
float x () const
 Gets the node's x coordinate. More...
 
float y () const
 Gets the node's y coordinate. More...
 
const Attributesattrs () const
 Gets all the node's Attributes. More...
 
const Valueattr (int id) const
 Gets the value of the attribute at id. More...
 
Value attr (const QString &name, Value defaultValue=Value()) const
 Gets the value corresponding to name. More...
 
Node randNeighbour (PRG *prg) const
 Gets a random neighbour. More...
 
const EdgesinEdges () const
 Gets the edges entering the node. More...
 
const EdgesoutEdges () const
 Gets the edges leaving the node. More...
 
int degree () const
 Gets the node's degree. More...
 
int inDegree () const
 Gets the node's in-degree, i.e., the number of edges entering the node. More...
 
int outDegree () const
 Gets the node's out-degree, i.e., the number of edges leaving the node. More...
 
void setAttr (const int id, const Value &value)
 Sets the value at id. More...
 
void setX (float x)
 Sets the node's x coordinate. More...
 
void setY (float y)
 Sets the node's y coordinate. More...
 
void setCoords (float x, float y)
 Sets the node's coordinates. More...
 

Friends

class AbstractGraph
 
class NodesPrivate
 
class TestNodes
 

Detailed Description

It wraps a std::shared_ptr<BaseNode>.

Constructor & Destructor Documentation

◆ Node() [1/3]

evoplex::Node::Node ( NodePtr  node)

Constructor.

Parameters
nodestd::shared_ptr<BaseNode>.

◆ Node() [2/3]

evoplex::Node::Node ( const std::pair< const int, Node > &  p)

Constructor to ease range-based for loops.

Parameters
pA pair <nodeId, Node>.

◆ Node() [3/3]

evoplex::Node::Node ( const std::pair< const int, Edge > &  p)

Constructor to ease range-based for loops.

Parameters
pA pair <nodeId, Edge>.

Member Function Documentation

◆ attr() [1/2]

const Value& evoplex::Node::attr ( int  id) const

Gets the value of the attribute at id.

Parameters
idThe attribute's id.
Exceptions
std::out_of_rangeif the id is not present.

◆ attr() [2/2]

Value evoplex::Node::attr ( const QString &  name,
Value  defaultValue = Value() 
) const

Gets the value corresponding to name.

Parameters
nameThe attribute's name.
defaultValueA Value to be returned if name is not present.

◆ attrs()

const Attributes& evoplex::Node::attrs ( ) const

Gets all the node's Attributes.

◆ clone()

NodePtr evoplex::Node::clone ( ) const

Creates a new std::shared_ptr<BaseNode> with the same data of the current Node.

◆ degree()

int evoplex::Node::degree ( ) const

Gets the node's degree.

◆ id()

int evoplex::Node::id ( ) const

Gets the node's id.

◆ inDegree()

int evoplex::Node::inDegree ( ) const

Gets the node's in-degree, i.e., the number of edges entering the node.

◆ inEdges()

const Edges& evoplex::Node::inEdges ( ) const

Gets the edges entering the node.

◆ outDegree()

int evoplex::Node::outDegree ( ) const

Gets the node's out-degree, i.e., the number of edges leaving the node.

◆ outEdges()

const Edges& evoplex::Node::outEdges ( ) const

Gets the edges leaving the node.

◆ randNeighbour()

Node evoplex::Node::randNeighbour ( PRG prg) const

Gets a random neighbour.

Returns an invalid/empty Node if the node has no neighbours.

◆ setAttr()

void evoplex::Node::setAttr ( const int  id,
const Value value 
)

Sets the value at id.

Parameters
idThe attribute's id.
valueThe new attribute's value.
Exceptions
std::out_of_rangeif the id is not present.

◆ setCoords()

void evoplex::Node::setCoords ( float  x,
float  y 
)

Sets the node's coordinates.

◆ setX()

void evoplex::Node::setX ( float  x)

Sets the node's x coordinate.

◆ setY()

void evoplex::Node::setY ( float  y)

Sets the node's y coordinate.

◆ x()

float evoplex::Node::x ( ) const

Gets the node's x coordinate.

◆ y()

float evoplex::Node::y ( ) const

Gets the node's y coordinate.


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