GPUOcelot
|
#include <DirectionalGraph.h>
Public Types | |
typedef unsigned int | node_type |
typedef std::set< node_type > | node_set |
typedef node_set::iterator | node_iterator |
typedef node_set::const_iterator | const_node_iterator |
typedef std::map< node_type, node_set > | arrows_map |
typedef arrows_map::iterator | arrow_iterator |
typedef std::pair< int, node_iterator > | node_action_info |
Public Member Functions | |
~DirectionalGraph () | |
Clears the graph data. | |
void | clear () |
Clears the graph data. | |
void | insertNode (const node_type &nodeId) |
Insert a node with nodeId. A duplicated ids is ignored. | |
size_t | nodesCount () const |
Number of nodes on the graph. | |
const_node_iterator | getBeginNode () const |
Get the first node. | |
const_node_iterator | getEndNode () const |
Get the node limit iterator. | |
const_node_iterator | findNode (const node_type &nodeId) const |
Get a node by it's id. | |
bool | hasNode (const node_type nodeId) const |
Tests if the graph has a node with certain id. | |
bool | eraseNode (const node_type &nodeId) |
Remove a node with certain id from the graph 1) Tests if node is present 2) Tests If there are outgoing arrows 2.1) Remove this node from each destiny's node id source list 2.2) Remove this node outgoing list 3) Tests If there are incoming arrows 3.1) Remove this node from each sources's node id destiny list 3.2) Remove this node sources list 4) Remove the node from the node list. | |
bool | eraseNode (const node_iterator &node) |
Remove a node with the id of the node from a node iterator. | |
const node_set | getOutNodesSet (const node_type &nodeId) const |
Get the outgoing edges[arrows] for a certain node. | |
const node_set | getInNodesSet (const node_type &nodeId) const |
Get the incoming edges[arrows] for a certain node. | |
int | insertEdge (const node_type &fromNode, const node_type &toNode, const bool createNewNodes=true) |
Insert a edge between two nodes. If the nodes doesn't exist they can be created 1) Tests if can create new nodes 1.1) Create ongoing and destiny nodes 1.2) Or test if both nodes exist 2) Insert / create / update list of ongoing edges for source node 3) Insert / create / update list of incoming edges for destiny node. | |
int | eraseEdge (const node_type &fromNode, const node_type &toNode, const bool removeIsolatedNodes=false) |
Remove an edge between two nodes. Can remove isolated nodes 1) Test if both nodes of the edge exist 2) Remove edges 3) Remove isolated nodes. | |
std::ostream & | print (std::ostream &out) const |
Protected Attributes | |
std::set< node_type > | nodes |
The set with the graph nodes. | |
std::map< node_type, node_set > | inArrows |
For each node, maps to which other nodes it has a edge[arrow] going to. | |
std::map< node_type, node_set > | outArrows |
For each node, maps from which other nodes it has a edge[arrow] coming from. |
typedef arrows_map::iterator analysis::DirectionalGraph::arrow_iterator |
typedef std::map<node_type, node_set> analysis::DirectionalGraph::arrows_map |
typedef node_set::const_iterator analysis::DirectionalGraph::const_node_iterator |
typedef std::pair<int, node_iterator> analysis::DirectionalGraph::node_action_info |
typedef node_set::iterator analysis::DirectionalGraph::node_iterator |
typedef std::set<node_type> analysis::DirectionalGraph::node_set |
typedef unsigned int analysis::DirectionalGraph::node_type |
analysis::DirectionalGraph::~DirectionalGraph | ( | ) |
Clears the graph data.
void analysis::DirectionalGraph::clear | ( | ) |
Clears the graph data.
Reimplemented in analysis::DivergenceGraph.
int analysis::DirectionalGraph::eraseEdge | ( | const node_type & | fromNode, |
const node_type & | toNode, | ||
const bool | removeIsolatedNodes = false |
||
) |
Remove an edge between two nodes. Can remove isolated nodes 1) Test if both nodes of the edge exist 2) Remove edges 3) Remove isolated nodes.
Reimplemented in analysis::DivergenceGraph.
bool analysis::DirectionalGraph::eraseNode | ( | const node_type & | nodeId | ) |
Remove a node with certain id from the graph 1) Tests if node is present 2) Tests If there are outgoing arrows 2.1) Remove this node from each destiny's node id source list 2.2) Remove this node outgoing list 3) Tests If there are incoming arrows 3.1) Remove this node from each sources's node id destiny list 3.2) Remove this node sources list 4) Remove the node from the node list.
Reimplemented in analysis::DivergenceGraph.
bool analysis::DirectionalGraph::eraseNode | ( | const node_iterator & | node | ) |
Remove a node with the id of the node from a node iterator.
Reimplemented in analysis::DivergenceGraph.
DirectionalGraph::const_node_iterator analysis::DirectionalGraph::findNode | ( | const node_type & | nodeId | ) | const |
Get a node by it's id.
DirectionalGraph::const_node_iterator analysis::DirectionalGraph::getBeginNode | ( | ) | const |
Get the first node.
DirectionalGraph::const_node_iterator analysis::DirectionalGraph::getEndNode | ( | ) | const |
Get the node limit iterator.
const DirectionalGraph::node_set analysis::DirectionalGraph::getInNodesSet | ( | const node_type & | nodeId | ) | const |
Get the incoming edges[arrows] for a certain node.
const DirectionalGraph::node_set analysis::DirectionalGraph::getOutNodesSet | ( | const node_type & | nodeId | ) | const |
Get the outgoing edges[arrows] for a certain node.
bool analysis::DirectionalGraph::hasNode | ( | const node_type | nodeId | ) | const |
Tests if the graph has a node with certain id.
int analysis::DirectionalGraph::insertEdge | ( | const node_type & | fromNode, |
const node_type & | toNode, | ||
const bool | createNewNodes = true |
||
) |
Insert a edge between two nodes. If the nodes doesn't exist they can be created 1) Tests if can create new nodes 1.1) Create ongoing and destiny nodes 1.2) Or test if both nodes exist 2) Insert / create / update list of ongoing edges for source node 3) Insert / create / update list of incoming edges for destiny node.
Reimplemented in analysis::DivergenceGraph.
void analysis::DirectionalGraph::insertNode | ( | const node_type & | nodeId | ) |
Insert a node with nodeId. A duplicated ids is ignored.
size_t analysis::DirectionalGraph::nodesCount | ( | ) | const |
Number of nodes on the graph.
std::ostream & analysis::DirectionalGraph::print | ( | std::ostream & | out | ) | const |
Reimplemented in analysis::DivergenceGraph.
std::map<node_type, node_set> analysis::DirectionalGraph::inArrows [protected] |
For each node, maps to which other nodes it has a edge[arrow] going to.
std::set<node_type> analysis::DirectionalGraph::nodes [protected] |
The set with the graph nodes.
std::map<node_type, node_set> analysis::DirectionalGraph::outArrows [protected] |
For each node, maps from which other nodes it has a edge[arrow] coming from.