DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Member Functions | Private Attributes | Friends | List of all members
Diades::Graph::GraphData Class Reference

#include <GraphData.hh>

Public Member Functions

vector< Edge > & vEdges ()
 
vector< Node > & vNodes ()
 
list< SizeType > & listEdgeId ()
 
list< SizeType > & listNodeId ()
 
const vector< Edge > & vEdges () const
 
const vector< Node > & vNodes () const
 
const list< SizeType > & listEdgeId () const
 
const list< SizeType > & listNodeId () const
 
unsigned id () const
 
 GraphData ()
 
virtual ~GraphData ()
 
bool sanityCheck (string &log) const
 
Accessors
SizeType numberOfNodes () const
 
SizeType numberOfEdges () const
 
bool empty () const
 
const Nodetarget (const Edge &edge) const
 
const Nodesource (const Edge &edge) const
 
bool cycleDetection (const Node &n) const
 
Construction of the graph
const NodenewNode ()
 
const NodenewNode (SizeType index)
 
Node getNode (SizeType index) const
 
Edge getEdge (SizeType index) const
 
const EdgenewEdge (Node source, Node target)
 
const EdgenewEdge (SizeType index, Node source, Node target)
 
Deletion
virtual void deleteNode (Node &node)
 
virtual void deleteNode (NodeIterator start, NodeIterator end)
 
virtual void deleteEdge (Edge &edge)
 
virtual void deleteEdge (EdgeIterator start, EdgeIterator end)
 
virtual void deleteEdge (LocalEdgeIterator start, LocalEdgeIterator end)
 
virtual void deleteAllEdges ()
 
void clear ()
 
Iterators
NodeIterator nodeBegin ()
 
NodeIterator nodeEnd ()
 
NodeIterator nodeBegin () const
 
NodeIterator nodeEnd () const
 
EdgeIterator edgeBegin ()
 
EdgeIterator edgeEnd ()
 
EdgeIterator edgeBegin () const
 
EdgeIterator edgeEnd () const
 
OutEdgeIterator outEdgeBegin (const Node &node) const
 
OutEdgeIterator outEdgeEnd (const Node &node) const
 
InEdgeIterator inEdgeBegin (const Node &node) const
 
InEdgeIterator inEdgeEnd (const Node &node) const
 
GraphDataoperator= (const GraphData &)
 
SizeType edgeCapacity () const
 
SizeType nodeCapacity () const
 

Private Attributes

vector< Edge_vEdges
 
vector< Node_vNodes
 
list< SizeType_listEdgeId
 
list< SizeType_listNodeId
 
SizeType _nbNodes
 
SizeType _nbEdges
 
unsigned _id
 

Friends

class Graph
 

Detailed Description

Definition at line 134 of file GraphData.hh.

Constructor & Destructor Documentation

Diades::Graph::GraphData::GraphData ( )

Default constructor

Make an empty graph

virtual Diades::Graph::GraphData::~GraphData ( )
virtual

Destructor

Desallocate all the memory resource used by its states and transitions. Destructor

Member Function Documentation

void Diades::Graph::GraphData::clear ( )

Elimination of edge paths

Parameters
sa Node
Precondition
s.valid() && s.owner()==this
Postcondition
s.outDeg()==0

Elimination of transition paths from the state s in the current graph. Make the graph empty

Desallocate all the memory resource used by its nodes and edges.

Referenced by Diades::Graph::Graph::clear(), and Diades::Graph::Graph::init().

bool Diades::Graph::GraphData::cycleDetection ( const Node n) const

Cycle detection

Parameters
na Node
Precondition
n.valid() && n.owner() = this
Returns
true if there is a cycle in the graph that involves susccessor nodes of n This method is a DFS algorithm

Referenced by Diades::Graph::Graph::cycleDetection().

virtual void Diades::Graph::GraphData::deleteAllEdges ( )
virtual

Deletion of all the edges

Referenced by Diades::Graph::Graph::deleteAllEdges().

virtual void Diades::Graph::GraphData::deleteEdge ( Edge edge)
virtual

Deletion of an Edge

Parameters
edgeEdge to delete
Precondition
edge.valid()
Postcondition
edge becomes invalid

Deletion of the Edge egde (desallocation of memory).

Referenced by Diades::Graph::Graph::deleteEdge(), and Diades::Graph::deleteEdge().

virtual void Diades::Graph::GraphData::deleteEdge ( EdgeIterator  start,
EdgeIterator  end 
)
virtual

Deletion of edges

Parameters
startEdgeIterator
endEdgeIterator

Deletion of the edges in [start,end) (desallocation of memory).

virtual void Diades::Graph::GraphData::deleteEdge ( LocalEdgeIterator  start,
LocalEdgeIterator  end 
)
virtual
virtual void Diades::Graph::GraphData::deleteNode ( Node node)
virtual

Deletion of a Node

Parameters
nodeNode to delete
Precondition
node.valid() and node.owner()==this
Postcondition
node becomes invalid

Deletion of the Node node. All the input and output edges of 'nodes' are deleted. (desallocation of memory)

Referenced by Diades::Graph::Graph::deleteNode(), and Diades::Graph::deleteNode().

virtual void Diades::Graph::GraphData::deleteNode ( NodeIterator  start,
NodeIterator  end 
)
virtual

Deletion of nodes

Parameters
startGraphIterator
endGraphIterator

Deletion of the nodes in [start,end). All the input and output edges are deleted. (desallocation of memory)

EdgeIterator Diades::Graph::GraphData::edgeBegin ( )
inline

Iterator for the transitions in the graph

Returns
start of iterator

Definition at line 432 of file GraphData.hh.

EdgeIterator Diades::Graph::GraphData::edgeBegin ( ) const
inline

Iterator for the transitions in the graph

Returns
start of iterator

Definition at line 453 of file GraphData.hh.

SizeType Diades::Graph::GraphData::edgeCapacity ( ) const
inline

Size of a graph

Returns
the memory usage of a graphSize of a sub-graph
Parameters
transitionsto measure
Returns
the memory usage of a sub-graphSize of a graph (nodes)
the memory usage of the graph nodesSize of a graph (edges)
the memory usage of the graph edges

Definition at line 539 of file GraphData.hh.

Referenced by Diades::Graph::Graph::edgeCapacity().

EdgeIterator Diades::Graph::GraphData::edgeEnd ( )
inline

Past-the-end iterator for the transitions of the graph.

Returns
end of iterator

Definition at line 442 of file GraphData.hh.

EdgeIterator Diades::Graph::GraphData::edgeEnd ( ) const
inline

Past-the-end iterator for the transitions of the graph.

Returns
end of iterator

Definition at line 463 of file GraphData.hh.

bool Diades::Graph::GraphData::empty ( ) const
inline

Return true if the graph is empty

Returns
the graph is empty

Definition at line 211 of file GraphData.hh.

References numberOfNodes().

Edge Diades::Graph::GraphData::getEdge ( SizeType  index) const

Get an Edge from its id

Parameters
idof the Edge
Returns
the Edge with the corresponding id
Postcondition
the returned Edge is not valid if no Edge with such an id exists in the GraphData

Referenced by Diades::Graph::Graph::getEdge().

Node Diades::Graph::GraphData::getNode ( SizeType  index) const

Get a Node from its id

Parameters
idof the Node
Returns
the Node with the corresponding id
Postcondition
the returned Node is not valid if no Node with such an id exists in the GraphData

Referenced by Diades::Graph::Graph::getNode().

unsigned Diades::Graph::GraphData::id ( ) const
inline

Definition at line 155 of file GraphData.hh.

References _id.

Referenced by Diades::Graph::Graph::id().

InEdgeIterator Diades::Graph::GraphData::inEdgeBegin ( const Node node) const

Iterator on Edges

Parameters
node: a Node
Precondition
node.valid() && node.owner() == this
Returns
a forward iterator pointing to the first input edge of node
InEdgeIterator Diades::Graph::GraphData::inEdgeEnd ( const Node node) const

Iterator on Edges

Parameters
node: a Node
Precondition
node.valid() && node.owner() == this
Returns
a forward iterator pointing to the end of all input edges of the node
list<SizeType>& Diades::Graph::GraphData::listEdgeId ( )
inline

Definition at line 149 of file GraphData.hh.

References _listEdgeId.

Referenced by boost::serialization::load().

const list<SizeType>& Diades::Graph::GraphData::listEdgeId ( ) const
inline

Definition at line 153 of file GraphData.hh.

References _listEdgeId.

list<SizeType>& Diades::Graph::GraphData::listNodeId ( )
inline

Definition at line 150 of file GraphData.hh.

References _listNodeId.

Referenced by boost::serialization::load().

const list<SizeType>& Diades::Graph::GraphData::listNodeId ( ) const
inline

Definition at line 154 of file GraphData.hh.

References _listNodeId.

const Edge& Diades::Graph::GraphData::newEdge ( Node  source,
Node  target 
)

Creation of a new edge

Parameters
sourceNode source of the new Edge
targetNode target of the new Edge
Precondition
source.valid(), source.owner()==this, target.valid(), target.owner()==this
Returns
the new edge (Edge)
Postcondition
the new edge is valid

Referenced by boost::serialization::load(), and Diades::Graph::Graph::newEdge().

const Edge& Diades::Graph::GraphData::newEdge ( SizeType  index,
Node  source,
Node  target 
)

Creation of a new edge (for serialization only)

Parameters
indexof the new edge
sourceNode source of the new Edge
targetNode target of the new Edge
Precondition
source.valid(), source.owner()==this, target.valid(), target.owner()==this
Returns
the new edge (Edge)
Postcondition
the new edge is valid
const Node& Diades::Graph::GraphData::newNode ( )

Creation of a new node

Parameters
referenceto the GraphData
Returns
the new Node
Postcondition
the new Node is valid

Referenced by boost::serialization::load(), and Diades::Graph::Graph::newNode().

const Node& Diades::Graph::GraphData::newNode ( SizeType  index)

Creation of a new node

Parameters
indexof the new node (for serialization only)
Returns
the new Node
Postcondition
the new Node is valid
NodeIterator Diades::Graph::GraphData::nodeBegin ( )
inline

Iterator for the nodes in the graph

Returns
start of iterator

Definition at line 390 of file GraphData.hh.

NodeIterator Diades::Graph::GraphData::nodeBegin ( ) const
inline

Iterator for the nodes in the graph

Returns
start of iterator

Definition at line 410 of file GraphData.hh.

SizeType Diades::Graph::GraphData::nodeCapacity ( ) const
inline

Definition at line 545 of file GraphData.hh.

Referenced by Diades::Graph::Graph::nodeCapacity().

NodeIterator Diades::Graph::GraphData::nodeEnd ( )
inline

Past-the-end iterator for the nodes of the graph.

Returns
end of iterator

Definition at line 399 of file GraphData.hh.

NodeIterator Diades::Graph::GraphData::nodeEnd ( ) const
inline

Past-the-end iterator for the nodes of the graph.

Returns
end of iterator

Definition at line 419 of file GraphData.hh.

SizeType Diades::Graph::GraphData::numberOfEdges ( ) const
inline

Return the number of transitions in the graph

Returns
number of transitions

Definition at line 201 of file GraphData.hh.

References _nbEdges.

Referenced by Diades::Graph::Graph::numberOfEdges().

SizeType Diades::Graph::GraphData::numberOfNodes ( ) const
inline

Return the number of states in the graph.

Returns
number of states

Definition at line 191 of file GraphData.hh.

References _nbNodes.

Referenced by empty(), and Diades::Graph::Graph::numberOfNodes().

GraphData& Diades::Graph::GraphData::operator= ( const GraphData )

Assignation

OutEdgeIterator Diades::Graph::GraphData::outEdgeBegin ( const Node node) const

Iterator on Edges

Parameters
node: a Node
Precondition
node.valid() && node.owner() == this
Returns
a forward iterator pointing to the first output edge of node
OutEdgeIterator Diades::Graph::GraphData::outEdgeEnd ( const Node node) const

Iterator on Edges

Parameters
node: a Node
Precondition
node.valid() && node.owner() == this
Returns
a forward iterator pointing to the end of all output edges of the node
bool Diades::Graph::GraphData::sanityCheck ( string &  log) const
Returns
true if the Graph is not corrupted, if corrupted, log will contain some information about the corruption

Referenced by Diades::Graph::Graph::sanityCheck().

const Node & Diades::Graph::GraphData::source ( const Edge edge) const
inline

Source state of an Edge

Parameters
edgean Edge
Precondition
edge.valid() && edge.owner() = this
Returns
the source Node of the Edge edge

Definition at line 675 of file GraphInt.hh.

References Diades::Graph::Edge::_eData, Diades::Graph::EdgeData::_source, _vNodes, Diades::Graph::Graph::data(), Diades::Graph::NodeData::identifier(), Diades::Graph::Edge::owner(), require, and Diades::Graph::Edge::valid().

Referenced by Diades::Graph::Edge::source(), and Diades::Graph::Graph::source().

const Node & Diades::Graph::GraphData::target ( const Edge edge) const
inline

Target Node of an Edge

Parameters
edgean Edge
Precondition
edge.valid() && edge.owner() = this
Returns
the target Node of the Edge edge

Definition at line 668 of file GraphInt.hh.

References Diades::Graph::Edge::_eData, Diades::Graph::EdgeData::_target, _vNodes, Diades::Graph::Graph::data(), Diades::Graph::NodeData::identifier(), Diades::Graph::Edge::owner(), require, and Diades::Graph::Edge::valid().

Referenced by Diades::Graph::Edge::target(), and Diades::Graph::Graph::target().

vector<Edge>& Diades::Graph::GraphData::vEdges ( )
inline

Definition at line 147 of file GraphData.hh.

References _vEdges.

Referenced by boost::serialization::load().

const vector<Edge>& Diades::Graph::GraphData::vEdges ( ) const
inline

Definition at line 151 of file GraphData.hh.

References _vEdges.

vector<Node>& Diades::Graph::GraphData::vNodes ( )
inline

Definition at line 148 of file GraphData.hh.

References _vNodes.

Referenced by boost::serialization::load().

const vector<Node>& Diades::Graph::GraphData::vNodes ( ) const
inline

Definition at line 152 of file GraphData.hh.

References _vNodes.

Friends And Related Function Documentation

friend class Graph
friend

Definition at line 554 of file GraphData.hh.

Member Data Documentation

unsigned Diades::Graph::GraphData::_id
private

Definition at line 144 of file GraphData.hh.

Referenced by id().

list<SizeType> Diades::Graph::GraphData::_listEdgeId
private

Definition at line 140 of file GraphData.hh.

Referenced by listEdgeId().

list<SizeType> Diades::Graph::GraphData::_listNodeId
private

Definition at line 141 of file GraphData.hh.

Referenced by listNodeId().

SizeType Diades::Graph::GraphData::_nbEdges
private

Definition at line 143 of file GraphData.hh.

Referenced by numberOfEdges().

SizeType Diades::Graph::GraphData::_nbNodes
private

Definition at line 142 of file GraphData.hh.

Referenced by numberOfNodes().

vector<Edge> Diades::Graph::GraphData::_vEdges
mutableprivate
vector<Node> Diades::Graph::GraphData::_vNodes
mutableprivate

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