Evoplex
0.2.1
|
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. | |
Node & | operator= (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 Attributes & | attrs () const |
Gets all the node's Attributes. More... | |
const Value & | attr (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 Edges & | inEdges () const |
Gets the edges entering the node. More... | |
const Edges & | outEdges () 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 |
It wraps a std::shared_ptr<BaseNode>.
evoplex::Node::Node | ( | NodePtr | node | ) |
Constructor.
node | std::shared_ptr<BaseNode>. |
evoplex::Node::Node | ( | const std::pair< const int, Node > & | p | ) |
Constructor to ease range-based for loops.
p | A pair <nodeId, Node>. |
evoplex::Node::Node | ( | const std::pair< const int, Edge > & | p | ) |
Constructor to ease range-based for loops.
p | A pair <nodeId, Edge>. |
const Value& evoplex::Node::attr | ( | int | id | ) | const |
Gets the value of the attribute at id
.
id | The attribute's id. |
std::out_of_range | if the id is not present. |
Gets the value corresponding to name
.
name | The attribute's name. |
defaultValue | A Value to be returned if name is not present. |
const Attributes& evoplex::Node::attrs | ( | ) | const |
Gets all the node's Attributes.
NodePtr evoplex::Node::clone | ( | ) | const |
Creates a new std::shared_ptr<BaseNode> with the same data of the current Node.
int evoplex::Node::degree | ( | ) | const |
Gets the node's degree.
int evoplex::Node::id | ( | ) | const |
Gets the node's id.
int evoplex::Node::inDegree | ( | ) | const |
Gets the node's in-degree, i.e., the number of edges entering the node.
const Edges& evoplex::Node::inEdges | ( | ) | const |
Gets the edges entering the node.
int evoplex::Node::outDegree | ( | ) | const |
Gets the node's out-degree, i.e., the number of edges leaving the node.
const Edges& evoplex::Node::outEdges | ( | ) | const |
Gets the edges leaving the node.
Gets a random neighbour.
Returns an invalid/empty Node if the node has no neighbours.
void evoplex::Node::setAttr | ( | const int | id, |
const Value & | value | ||
) |
Sets the value at id
.
id | The attribute's id. |
value | The new attribute's value. |
std::out_of_range | if the id is not present. |
void evoplex::Node::setCoords | ( | float | x, |
float | y | ||
) |
Sets the node's coordinates.
void evoplex::Node::setX | ( | float | x | ) |
Sets the node's x
coordinate.
void evoplex::Node::setY | ( | float | y | ) |
Sets the node's y
coordinate.
float evoplex::Node::x | ( | ) | const |
Gets the node's x coordinate.
float evoplex::Node::y | ( | ) | const |
Gets the node's y coordinate.