Evoplex  0.2.1
Functions
Base Graph

Groups all the base fuctions available for any graph plugin. More...

Functions

const QString & evoplex::AbstractGraph::id () const
 Gets the graph id.
 
GraphType evoplex::AbstractGraph::type () const
 Gets the graph type.
 
bool evoplex::AbstractGraph::isDirected () const
 Returns true if the graph is directed.
 
bool evoplex::AbstractGraph::isUndirected () const
 Returns true if the graph is undirected.
 
const Edgesevoplex::AbstractGraph::edges () const
 Gets the edges.
 
const Edgeevoplex::AbstractGraph::edge (int edgeId) const
 Returns the Edge corresponding to edgeId. More...
 
const Edgeevoplex::AbstractGraph::edge (int originId, int neighbourId) const
 Returns the Edge that connects originId to neighbourId. More...
 
const Nodesevoplex::AbstractGraph::nodes () const
 Gets the nodes.
 
Node evoplex::AbstractGraph::node (int nodeId) const
 Gets the Node corresponding to nodeId. More...
 
Node evoplex::AbstractGraph::randNode () const
 Gets a random Node in the graph. More...
 
int evoplex::AbstractGraph::numNodes () const
 Gets the number of nodes in the graph.
 
int evoplex::AbstractGraph::numEdges () const
 Gets the number of edges in the graph.
 
Node evoplex::AbstractGraph::addNode (Attributes attr)
 Creates a Node with attrs and adds it into the graph. More...
 
Node evoplex::AbstractGraph::addNode (Attributes attr, float x, float y)
 Creates a Node with attrs and adds it into the graph. More...
 
Edge evoplex::AbstractGraph::addEdge (int originId, int neighbourId, Attributes *attrs=new Attributes())
 Creates and adds an Edge into the graph. More...
 
Edge evoplex::AbstractGraph::addEdge (const Node &origin, const Node &neighbour, Attributes *attrs=new Attributes())
 Creates and adds an Edge into the graph. More...
 
void evoplex::AbstractGraph::removeAllEdges ()
 Removes all edges of the graph.
 
void evoplex::AbstractGraph::removeAllEdges (const Node &node)
 Removes all edges of the node. More...
 
void evoplex::AbstractGraph::removeNode (const Node &node)
 Removes the node from the graph. More...
 
Nodes::iterator evoplex::AbstractGraph::removeNode (Nodes::iterator it)
 Removes a node from the graph. More...
 
void evoplex::AbstractGraph::removeEdge (const Edge &edge)
 Removes the edge from the graph. More...
 
Edges::iterator evoplex::AbstractGraph::removeEdge (Edges::iterator it)
 Removes an edge from the graph. More...
 

Detailed Description

Groups all the base fuctions available for any graph plugin.

For more information: https://evoplex.org/docs/creating-plugins

See also
AbstractPlugin, AbstractGraph, AbstractModel

Function Documentation

◆ addEdge() [1/2]

Edge evoplex::AbstractGraph::addEdge ( int  originId,
int  neighbourId,
Attributes attrs = new Attributes() 
)
inline

Creates and adds an Edge into the graph.

Parameters
originIdthe id of the source Node
neighbourIdthe id of the target Node
attrsthe edge's attributes
Returns
the new Edge
Warning
the nodes' ids must belong to the graph.

◆ addEdge() [2/2]

Edge evoplex::AbstractGraph::addEdge ( const Node origin,
const Node neighbour,
Attributes attrs = new Attributes() 
)

Creates and adds an Edge into the graph.

Parameters
originthe source Node
neighbourthe target Node
attrsthe edge's attributes
Returns
the new Edge
Warning
the nodes' ids must belong to the graph.

◆ addNode() [1/2]

Node evoplex::AbstractGraph::addNode ( Attributes  attr)
inline

Creates a Node with attrs and adds it into the graph.

Returns
the new Node
Parameters
attrnodes' attributes

◆ addNode() [2/2]

Node evoplex::AbstractGraph::addNode ( Attributes  attr,
float  x,
float  y 
)

Creates a Node with attrs and adds it into the graph.

Returns
the new Node
Parameters
attrnodes' attributes
x,ynodes's coordinates

◆ edge() [1/2]

const Edge & evoplex::AbstractGraph::edge ( int  edgeId) const
inline

Returns the Edge corresponding to edgeId.

Parameters
edgeIdA valid edge id.
Exceptions
std::out_of_rangeif no such data is present.

◆ edge() [2/2]

const Edge & evoplex::AbstractGraph::edge ( int  originId,
int  neighbourId 
) const
inline

Returns the Edge that connects originId to neighbourId.

Parameters
originIdA valid node id.
neighbourIdA valid node id.
Exceptions
std::out_of_rangeif no such data is present.

◆ node()

Node evoplex::AbstractGraph::node ( int  nodeId) const
inline

Gets the Node corresponding to nodeId.

Parameters
nodeIdA valid node id.
Exceptions
std::out_of_rangeif no such data is present.

◆ randNode()

Node evoplex::AbstractGraph::randNode ( ) const

Gets a random Node in the graph.

Returns
If the graph has no nodes, it returns an invalid/empty Node.

◆ removeAllEdges()

void evoplex::AbstractGraph::removeAllEdges ( const Node node)

Removes all edges of the node.

Parameters
nodeA Node that belongs to the graph.

◆ removeEdge() [1/2]

void evoplex::AbstractGraph::removeEdge ( const Edge edge)

Removes the edge from the graph.

Parameters
edgeAn Edge that belongs to the graph.

◆ removeEdge() [2/2]

Edges::iterator evoplex::AbstractGraph::removeEdge ( Edges::iterator  it)

Removes an edge from the graph.

Parameters
itAn iterator pointing to an Edge in the graph to be erased.
Returns
An iterator pointing to the Edge immediately following it prior to the Edge being erased. If no such Edge exists, end() is returned.

◆ removeNode() [1/2]

void evoplex::AbstractGraph::removeNode ( const Node node)

Removes the node from the graph.

Parameters
nodeA Node that belongs to the graph.

◆ removeNode() [2/2]

Nodes::iterator evoplex::AbstractGraph::removeNode ( Nodes::iterator  it)

Removes a node from the graph.

Parameters
itAn iterator pointing to a Node in the graph to be erased.
Returns
An iterator pointing to the Node immediately following it prior to the Node being erased. If no such Node exists, end() is returned.