GPUOcelot
Public Types | Public Member Functions | Protected Attributes

analysis::DirectionalGraph Class Reference

#include <DirectionalGraph.h>

Inheritance diagram for analysis::DirectionalGraph:
Inheritance graph
[legend]

List of all members.

Public Types

typedef unsigned int node_type
typedef std::set< node_typenode_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_typenodes
 The set with the graph nodes.
std::map< node_type, node_setinArrows
 For each node, maps to which other nodes it has a edge[arrow] going to.
std::map< node_type, node_setoutArrows
 For each node, maps from which other nodes it has a edge[arrow] coming from.

Member Typedef Documentation

typedef arrows_map::iterator analysis::DirectionalGraph::arrow_iterator
typedef node_set::const_iterator analysis::DirectionalGraph::const_node_iterator
typedef node_set::iterator analysis::DirectionalGraph::node_iterator

Constructor & Destructor Documentation

analysis::DirectionalGraph::~DirectionalGraph ( )

Clears the graph data.


Member Function Documentation

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.


Member Data Documentation

For each node, maps to which other nodes it has a edge[arrow] going to.

The set with the graph nodes.

For each node, maps from which other nodes it has a edge[arrow] coming from.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines