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

#include <GraphInt.hh>

Public Types

typedef Diades::Utils::Exception< GraphException
 
typedef vector< Edge >::size_type EdgeSizeType
 
typedef vector< Node >::size_type NodeSizeType
 
typedef Edge::EdgeId EdgeId
 
typedef Node::NodeId NodeId
 
typedef vector< Node >::size_type SizeType
 

Public Member Functions

vector< Edge > & vEdges ()
 
vector< Node > & vNodes ()
 
list< EdgeSizeType > & listEdgeId ()
 
list< NodeSizeType > & listNodeId ()
 
const vector< Edge > & vEdges () const
 
const vector< Node > & vNodes () const
 
const list< EdgeSizeType > & listEdgeId () const
 
const list< NodeSizeType > & listNodeId () const
 
unsigned id () const
 
 Graph ()
 
 Graph (const Graph &graph)
 
virtual ~Graph ()
 
Graphoperator= (const Graph &graph)
 
bool sanityCheck (string &log) const
 
ostream & toDot (ostream &os)
 
void transitiveClosure (Edge edge)
 
bool sanityCheck (string &log) const
 
bool valid () const
 
ostream & toDot (ostream &os)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
Accessors
bool succeeds (const Node &n1, const Node &n2) const
 
NodeSizeType numberOfNodes () const
 
EdgeSizeType numberOfEdges () const
 
bool empty () const
 
Node target (const Edge &edge) const
 
Node source (const Edge &edge) const
 
const NodetargetRef (const Edge &edge) const
 
const NodesourceRef (const Edge &edge) const
 
bool cycleDetection (const Node &n) const
 
bool succeeds (const Node &n1, const Node &n2) const
 
bool preceeds (const Node &n1, const Node &n2) const
 
bool operator== (const Graph &g) const
 
bool operator!= (const Graph &g) const
 
bool operator< (const Graph &g) const
 
SizeType numberOfNodes () const
 
SizeType numberOfEdges () const
 
bool empty () const
 
Node target (const Edge &edge) const
 
Node source (const Edge &edge) const
 
const NodetargetRef (const Edge &edge) const
 
const NodesourceRef (const Edge &edge) const
 
Node getNode (unsigned id) const
 
Edge getEdge (unsigned id) const
 
void transitiveClosure (Edge edge)
 
bool cycleDetection (const Node &n) const
 
Construction of the graph
Node newNode ()
 
Node newNode (NodeSizeType index)
 
Node getNode (NodeSizeType index) const
 
Edge getEdge (EdgeSizeType index) const
 
Edge newEdge (Node source, Node target)
 
Edge newEdge (EdgeSizeType index, Node source, Node target)
 
Node newNode ()
 
Edge newEdge (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 ()
 
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
 
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
 
EdgeSizeType edgeCapacity () const
 
NodeSizeType nodeCapacity () const
 
Constructors and Destructor
 Graph ()
 
 Graph (GraphData *data)
 
 Graph (const Graph &g)
 
const GraphData * data () const
 
GraphData * data ()
 
unsigned id () const
 
void init ()
 
void destroy ()
 
virtual ~Graph ()
 
Graphoperator= (const Graph &g)
 
SizeType edgeCapacity () const
 
SizeType nodeCapacity () const
 

Static Public Member Functions

static string typeName ()
 

Private Member Functions

void copyGraph (const Graph &graph)
 

Private Attributes

vector< Edge_vEdges
 
vector< Node_vNodes
 
list< EdgeSizeType_listEdgeId
 
list< NodeSizeType_listNodeId
 
NodeSizeType _nbNodes
 
EdgeSizeType _nbEdges
 
unsigned _id
 
GraphData * _data
 

Friends

ostream & operator<< (ostream &os, const Graph &g)
 

Detailed Description

This library is a very basic implementation of graph structure. A Graph implements a directed graph structure. This Graph is composed of states (State) and edges (Edge). A State implements the notion of node of the Graph and a Edge implements the notion of edge of the Graph. In order to add some information to a State, you have to use a StateMap. To add an information to a Edge, you have to use a EdgeMap. A State object is a small object so it can be used like a reference (the real data of the State are in StateData). A Edge object can also be used like a reference (the real data of the EdgeData).

A few graph algorithms have been implemented in the library (Tremaux, and Tarjan)

Here is an example how to use the Graph library:

Node s1 = g.newNode();
Node s2 = g.newNode();
Edge t = g.newEdge(s1,s2);
NodeMap<int> index(g);
EdgeMap<string> label(g);
index[s1]=1;
index[s2]=2;
label[t]="a";
for(EdgeIterator it = g.beginOfEdge(); it != g.endOfEdge(); ++it) {
cout << index[it->source()] << label[*it] << index[it->target()] << endl;
}

A Graph.

A Graph defines a directed graph. A Graph is a set of nodes (Node) and edges (Edge).

Author
Y. Pencole
Version
1.0

Definition at line 176 of file GraphInt.hh.

Member Typedef Documentation

◆ EdgeId

typedef Edge::EdgeId Diades::Graph::Graph::EdgeId

Definition at line 184 of file GraphInt.hh.

◆ EdgeSizeType

typedef vector<Edge>::size_type Diades::Graph::Graph::EdgeSizeType

Definition at line 182 of file GraphInt.hh.

◆ Exception

typedef Diades::Utils::Exception<Graph> Diades::Graph::Graph::Exception

Definition at line 181 of file GraphInt.hh.

◆ NodeId

typedef Node::NodeId Diades::Graph::Graph::NodeId

Definition at line 185 of file GraphInt.hh.

◆ NodeSizeType

typedef vector<Node>::size_type Diades::Graph::Graph::NodeSizeType

Definition at line 183 of file GraphInt.hh.

◆ SizeType

typedef vector<Node>::size_type Diades::Graph::Graph::SizeType

Definition at line 41 of file GraphIntOld.hh.

Constructor & Destructor Documentation

◆ Graph() [1/5]

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

◆ Graph() [2/5]

Diades::Graph::Graph::Graph ( const Graph graph)

Copy contructor

Parameters
graphthe Graph to copy The copy is a full semantical copy however, the copy has its own identifier the nodes and edges are also copied. The internal representation does not have necessarily the same structure. The Node ids and edge ids are the same.

◆ ~Graph() [1/2]

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

Destructor

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

Referenced by id().

◆ Graph() [3/5]

Diades::Graph::Graph::Graph ( )
inline

Default constructor

Make an empty graph

Definition at line 55 of file GraphIntOld.hh.

◆ Graph() [4/5]

Diades::Graph::Graph::Graph ( GraphData *  data)
inline

Parametrized constructor

Make an empty graph

Definition at line 63 of file GraphIntOld.hh.

◆ Graph() [5/5]

Diades::Graph::Graph::Graph ( const Graph g)
inline

Copy constructor

Parameters
gGraph to copy

Definition at line 72 of file GraphIntOld.hh.

◆ ~Graph() [2/2]

virtual Diades::Graph::Graph::~Graph ( )
inlinevirtual

Destructor Destructor

Definition at line 151 of file GraphIntOld.hh.

Member Function Documentation

◆ clear() [1/2]

void Diades::Graph::Graph::clear ( )
inline

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.

Definition at line 478 of file GraphIntOld.hh.

References require, and valid().

◆ clear() [2/2]

void Diades::Graph::Graph::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::Utils::PartialOrder< Diades::Petri::Extension, Diades::Petri::AdequateOrder, Diades::Petri::ExtensionEquality >::clear(), Diades::Automata::Experimental::StateMachine< _StatePropertyId, _InputSymbolId, _NullStatePropertyId, _NullInputSymbolId >::clear(), empty(), and Diades::Automata::ClassicalDiagnoser::~ClassicalDiagnoser().

◆ copyGraph()

void Diades::Graph::Graph::copyGraph ( const Graph graph)
private

Copy contructor

Parameters
graphthe Graph to copy The copy is a full semantical copy however, the copy has its own identifier the nodes and edges are also copied. The internal representation does not have necessarily the same structure. The Node ids and edge ids are the same.

Referenced by operator=().

◆ cycleDetection() [1/2]

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

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

Definition at line 350 of file GraphIntOld.hh.

References newNode(), require, and valid().

◆ cycleDetection() [2/2]

bool Diades::Graph::Graph::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 empty().

◆ data() [1/2]

const GraphData* Diades::Graph::Graph::data ( ) const
inline
Returns
the internal data associated to this Graph

Definition at line 80 of file GraphIntOld.hh.

References _data.

Referenced by source(), and sourceRef().

◆ data() [2/2]

GraphData* Diades::Graph::Graph::data ( )
inline
Returns
the internal data associated to this Graph

Definition at line 89 of file GraphIntOld.hh.

References _data.

◆ deleteAllEdges() [1/2]

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

Deletion of all the edges

Definition at line 456 of file GraphIntOld.hh.

References require, and valid().

◆ deleteAllEdges() [2/2]

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

Deletion of all the edges

Referenced by empty().

◆ deleteEdge() [1/6]

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

Deletion of an Edge

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

Deletion of the Edge egde (desallocation of memory).

Definition at line 427 of file GraphIntOld.hh.

References require, and valid().

◆ deleteEdge() [2/6]

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

Deletion of edges

Parameters
startEdgeIterator
endEdgeIterator

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

Definition at line 441 of file GraphIntOld.hh.

References require, and valid().

◆ deleteEdge() [3/6]

virtual void Diades::Graph::Graph::deleteEdge ( LocalEdgeIterator  start,
LocalEdgeIterator  end 
)
inlinevirtual

Definition at line 447 of file GraphIntOld.hh.

References require, and valid().

◆ deleteEdge() [4/6]

virtual void Diades::Graph::Graph::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::Automata::Experimental::StateMachine< _StatePropertyId, _InputSymbolId, _NullStatePropertyId, _NullInputSymbolId >::deleteTransition(), empty(), and inEdgeEnd().

◆ deleteEdge() [5/6]

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

Deletion of edges

Parameters
startEdgeIterator
endEdgeIterator

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

◆ deleteEdge() [6/6]

virtual void Diades::Graph::Graph::deleteEdge ( LocalEdgeIterator  start,
LocalEdgeIterator  end 
)
virtual

◆ deleteNode() [1/4]

virtual void Diades::Graph::Graph::deleteNode ( Node node)
inlinevirtual

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)

Definition at line 395 of file GraphIntOld.hh.

References require, and valid().

◆ deleteNode() [2/4]

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

Deletion of nodes

Parameters
startGraphIterator
endGraphIterator

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

Definition at line 411 of file GraphIntOld.hh.

References require, and valid().

◆ deleteNode() [3/4]

virtual void Diades::Graph::Graph::deleteNode ( Node node)
virtual

◆ deleteNode() [4/4]

virtual void Diades::Graph::Graph::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)

◆ destroy()

void Diades::Graph::Graph::destroy ( )
inline

Destroy the graph (be careful, all living Graph objects pointing at the same internal data must be erased as well, not in use anymore.)

Definition at line 129 of file GraphIntOld.hh.

References _data, and valid().

◆ edgeBegin() [1/4]

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

Iterator for the transitions in the graph

Returns
start of iterator

Definition at line 541 of file GraphIntOld.hh.

References require, and valid().

◆ edgeBegin() [2/4]

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

Iterator for the transitions in the graph

Returns
start of iterator

Definition at line 564 of file GraphIntOld.hh.

References require, and valid().

◆ edgeBegin() [3/4]

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

◆ edgeBegin() [4/4]

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

Iterator for the transitions in the graph

Returns
start of iterator

Definition at line 583 of file GraphInt.hh.

◆ edgeCapacity() [1/2]

SizeType Diades::Graph::Graph::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 657 of file GraphIntOld.hh.

References require, and valid().

◆ edgeCapacity() [2/2]

EdgeSizeType Diades::Graph::Graph::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 660 of file GraphInt.hh.

◆ edgeEnd() [1/4]

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

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

Returns
end of iterator

Definition at line 552 of file GraphIntOld.hh.

References require, and valid().

◆ edgeEnd() [2/4]

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

◆ edgeEnd() [3/4]

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

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

Returns
end of iterator

Definition at line 575 of file GraphIntOld.hh.

References inEdgeBegin(), inEdgeEnd(), outEdgeBegin(), outEdgeEnd(), require, and valid().

◆ edgeEnd() [4/4]

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

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

Returns
end of iterator

Definition at line 592 of file GraphInt.hh.

References inEdgeBegin(), inEdgeEnd(), outEdgeBegin(), and outEdgeEnd().

◆ empty() [1/2]

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

Return true if the graph is empty

Returns
the graph is empty

Definition at line 272 of file GraphIntOld.hh.

References getEdge(), getNode(), numberOfNodes(), require, source(), sourceRef(), target(), targetRef(), transitiveClosure(), and valid().

◆ empty() [2/2]

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

◆ getEdge() [1/2]

Edge Diades::Graph::Graph::getEdge ( unsigned  id) const
inline

Get Edge from its id

Parameters
idthe identifier of the Edge
Returns
the Edge of the Graph associated to the id, an invalid Edge if such an Edge does not exist.

Definition at line 720 of file GraphIntOld.hh.

References _data, and valid().

◆ getEdge() [2/2]

Edge Diades::Graph::Graph::getEdge ( EdgeSizeType  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 empty(), and Diades::Automata::Experimental::StateMachine< _StatePropertyId, _InputSymbolId, _NullStatePropertyId, _NullInputSymbolId >::finaliseTransitions().

◆ getNode() [1/2]

Node Diades::Graph::Graph::getNode ( unsigned  id) const
inline

Get Node from its id

Parameters
idthe identifier of the Node
Returns
the Node of the Graph associated to the id, an invalid node if such a Node does not exist.

Definition at line 711 of file GraphIntOld.hh.

References _data, and valid().

◆ getNode() [2/2]

Node Diades::Graph::Graph::getNode ( NodeSizeType  index) const

◆ id() [1/2]

unsigned Diades::Graph::Graph::id ( ) const
inline
Returns
the internal id of the Graph

Definition at line 98 of file GraphIntOld.hh.

References valid().

◆ id() [2/2]

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

Definition at line 242 of file GraphInt.hh.

References _id, Graph(), and ~Graph().

Referenced by Diades::Graph::Edge::operator<(), operator<(), and boost::serialization::save().

◆ inEdgeBegin() [1/2]

InEdgeIterator Diades::Graph::Graph::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

◆ inEdgeBegin() [2/2]

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

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

Definition at line 822 of file GraphIntOld.hh.

References Diades::Graph::Node::inEdgeBegin(), Diades::Graph::Node::owner(), require, and Diades::Graph::Node::valid().

Referenced by edgeEnd().

◆ inEdgeEnd() [1/2]

InEdgeIterator Diades::Graph::Graph::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

◆ inEdgeEnd() [2/2]

InEdgeIterator Diades::Graph::Graph::inEdgeEnd ( const Node node) const
inline

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

Definition at line 828 of file GraphIntOld.hh.

References deleteEdge(), Diades::Graph::Node::inEdgeEnd(), Diades::Graph::Node::owner(), require, and Diades::Graph::Node::valid().

Referenced by edgeEnd().

◆ init()

void Diades::Graph::Graph::init ( )
inline

Initialisation

Parameters
makean empty graph

Definition at line 110 of file GraphIntOld.hh.

References valid().

◆ listEdgeId() [1/2]

list<EdgeSizeType>& Diades::Graph::Graph::listEdgeId ( )
inline

Definition at line 218 of file GraphInt.hh.

References _listEdgeId.

◆ listEdgeId() [2/2]

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

Definition at line 234 of file GraphInt.hh.

References _listEdgeId.

◆ listNodeId() [1/2]

list<NodeSizeType>& Diades::Graph::Graph::listNodeId ( )
inline

Definition at line 222 of file GraphInt.hh.

References _listNodeId.

◆ listNodeId() [2/2]

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

Definition at line 238 of file GraphInt.hh.

References _listNodeId.

◆ newEdge() [1/3]

Edge Diades::Graph::Graph::newEdge ( Node  source,
Node  target 
)
inline

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

Definition at line 377 of file GraphIntOld.hh.

References require, and valid().

◆ newEdge() [2/3]

Edge Diades::Graph::Graph::newEdge ( Node  source,
Node  target 
)

◆ newEdge() [3/3]

Edge Diades::Graph::Graph::newEdge ( EdgeSizeType  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

◆ newNode() [1/3]

Node Diades::Graph::Graph::newNode ( )

Creation of a new node

Returns
the new Node
Postcondition
the new Node is valid

◆ newNode() [2/3]

Node Diades::Graph::Graph::newNode ( )
inline

◆ newNode() [3/3]

Node Diades::Graph::Graph::newNode ( NodeSizeType  index)

Creation of a new node

Parameters
indexof the new node (for serialization only)
Returns
the new Node
Postcondition
the new Node is valid

◆ nodeBegin() [1/4]

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

Iterator for the nodes in the graph

Returns
start of iterator

Definition at line 495 of file GraphIntOld.hh.

References require, and valid().

◆ nodeBegin() [2/4]

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

Iterator for the nodes in the graph

Returns
start of iterator

Definition at line 517 of file GraphIntOld.hh.

References require, and valid().

◆ nodeBegin() [3/4]

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

◆ nodeBegin() [4/4]

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

Iterator for the nodes in the graph

Returns
start of iterator

Definition at line 547 of file GraphInt.hh.

◆ nodeCapacity() [1/2]

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

Definition at line 668 of file GraphIntOld.hh.

References require, and valid().

◆ nodeCapacity() [2/2]

NodeSizeType Diades::Graph::Graph::nodeCapacity ( ) const
inline

Definition at line 669 of file GraphInt.hh.

References Diades::Utils::log(), sanityCheck(), toDot(), and transitiveClosure().

◆ nodeEnd() [1/4]

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

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

Returns
end of iterator

Definition at line 505 of file GraphIntOld.hh.

References require, and valid().

◆ nodeEnd() [2/4]

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

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

Returns
end of iterator

Definition at line 527 of file GraphIntOld.hh.

References require, and valid().

◆ nodeEnd() [3/4]

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

◆ nodeEnd() [4/4]

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

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

Returns
end of iterator

Definition at line 556 of file GraphInt.hh.

◆ numberOfEdges() [1/2]

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

Return the number of transitions in the graph

Returns
number of transitions

Definition at line 261 of file GraphIntOld.hh.

References require, and valid().

◆ numberOfEdges() [2/2]

EdgeSizeType Diades::Graph::Graph::numberOfEdges ( ) const
inline

◆ numberOfNodes() [1/2]

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

Return the number of states in the graph.

Returns
number of states

Definition at line 250 of file GraphIntOld.hh.

References require, and valid().

◆ numberOfNodes() [2/2]

NodeSizeType Diades::Graph::Graph::numberOfNodes ( ) const
inline

◆ operator!=()

bool Diades::Graph::Graph::operator!= ( const Graph g) const
inline

◆ operator<()

bool Diades::Graph::Graph::operator< ( const Graph g) const
inline

Comparison operator

Parameters
gthe Graph to compare (pointer inequality)
Returns
true if the current graph is "less than" g

Definition at line 226 of file GraphIntOld.hh.

References id(), and valid().

◆ operator=() [1/2]

Graph& Diades::Graph::Graph::operator= ( const Graph graph)
inline
Parameters
graphthe graph to copy
Returns
the assigned Graph he copy is a full semantical copy however, the copy has its own identifier the nodes and edges are also copied. The internal representation does not have necessarily the same structure. The Node ids and edge ids are the same.

Definition at line 282 of file GraphInt.hh.

References copyGraph(), and succeeds().

◆ operator=() [2/2]

Graph& Diades::Graph::Graph::operator= ( const Graph g)
inline

Assignation

Definition at line 619 of file GraphIntOld.hh.

◆ operator==()

bool Diades::Graph::Graph::operator== ( const Graph g) const
inline

◆ outEdgeBegin() [1/2]

OutEdgeIterator Diades::Graph::Graph::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

◆ outEdgeBegin() [2/2]

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

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

Definition at line 810 of file GraphIntOld.hh.

References Diades::Graph::Node::outEdgeBegin(), Diades::Graph::Node::owner(), require, and Diades::Graph::Node::valid().

Referenced by edgeEnd().

◆ outEdgeEnd() [1/2]

OutEdgeIterator Diades::Graph::Graph::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

◆ outEdgeEnd() [2/2]

OutEdgeIterator Diades::Graph::Graph::outEdgeEnd ( const Node node) const
inline

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

Definition at line 816 of file GraphIntOld.hh.

References Diades::Graph::Node::outEdgeEnd(), Diades::Graph::Node::owner(), require, and Diades::Graph::Node::valid().

Referenced by edgeEnd().

◆ preceeds()

bool Diades::Graph::Graph::preceeds ( const Node n1,
const Node n2 
) const
inline
Parameters
n1a Node of the Graph
n2a Node of the Graph
Returns
true if there is a path from n1 to n2

Definition at line 186 of file GraphIntOld.hh.

References succeeds().

◆ sanityCheck() [1/2]

bool Diades::Graph::Graph::sanityCheck ( string &  log) const
Returns
true if the Graph is not corrupted, if corrupted, log will contain some information about the corruption

Referenced by nodeCapacity().

◆ sanityCheck() [2/2]

bool Diades::Graph::Graph::sanityCheck ( string &  log) const
inline
Returns
true if the Graph is not corrupted, if corrupted, log will contain some information about the corruption

Definition at line 676 of file GraphIntOld.hh.

References valid().

◆ serialize()

template<class Archive >
void Diades::Graph::Graph::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 699 of file GraphIntOld.hh.

References _data.

◆ source() [1/2]

Node Diades::Graph::Graph::source ( const Edge edge) const

Source state of an Edge

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

◆ source() [2/2]

Node Diades::Graph::Graph::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 744 of file GraphIntOld.hh.

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

Referenced by empty(), and boost::serialization::save().

◆ sourceRef() [1/2]

const Node& Diades::Graph::Graph::sourceRef ( const Edge edge) const

Source state of an Edge

Parameters
edgean Edge
Precondition
edge.valid() && edge.owner() = this The Graph must be constant (no delete/add of anything) as long as the returned reference is in use !!
Returns
the source Node of the Edge edge

◆ sourceRef() [2/2]

const Node & Diades::Graph::Graph::sourceRef ( const Edge edge) const
inline

Source state of an Edge

Parameters
edgean Edge
Precondition
edge.valid() && edge.owner() = this. The Graph must be constant (no delete/add of anything) as long as the returned reference is in use !!
Returns
the source Node of the Edge edge

Definition at line 775 of file GraphIntOld.hh.

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

Referenced by empty().

◆ succeeds() [1/2]

bool Diades::Graph::Graph::succeeds ( const Node n1,
const Node n2 
) const
inline
Parameters
n1a Node of the Graph
n2a Node of the Graph
Returns
true if there is a path from n2 to n1

Definition at line 172 of file GraphIntOld.hh.

◆ succeeds() [2/2]

bool Diades::Graph::Graph::succeeds ( const Node n1,
const Node n2 
) const
Parameters
n1a Node of the Graph
n2a Node of the Graph
Returns
true if there is a path from n2 to n1

Referenced by operator=(), and preceeds().

◆ target() [1/2]

Node Diades::Graph::Graph::target ( const Edge edge) const

Target Node of an Edge

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

◆ target() [2/2]

Node Diades::Graph::Graph::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 736 of file GraphIntOld.hh.

References _data, Diades::Graph::Edge::owner(), require, Diades::Graph::Edge::valid(), and valid().

Referenced by empty(), and boost::serialization::save().

◆ targetRef() [1/2]

const Node& Diades::Graph::Graph::targetRef ( const Edge edge) const

Target Node of an Edge

Parameters
edgean Edge
Precondition
edge.valid() && edge.owner() = this. The Graph must be constant (no delete/add of anything) as long as the returned reference is in use !!
Returns
the target Node of the Edge edge

◆ targetRef() [2/2]

const Node & Diades::Graph::Graph::targetRef ( const Edge edge) const
inline

Target Node of an Edge

Parameters
edgean Edge
Precondition
edge.valid() && edge.owner() = this. The Graph must be constant (no delete/add of anything) as long as the returned reference is in use !!
Returns
the target Node of the Edge edge

Definition at line 767 of file GraphIntOld.hh.

References _data, Diades::Graph::Edge::owner(), require, Diades::Graph::Edge::valid(), and valid().

Referenced by empty().

◆ toDot() [1/2]

ostream& Diades::Graph::Graph::toDot ( ostream &  os)
Returns
the graph in GraphViz format in the output stream

Referenced by nodeCapacity(), and valid().

◆ toDot() [2/2]

ostream& Diades::Graph::Graph::toDot ( ostream &  os)
Returns
the graph in GraphViz format in the output stream

◆ transitiveClosure() [1/2]

void Diades::Graph::Graph::transitiveClosure ( Edge  edge)

Transitive closure of a edge. This methods transforms the current graph so that the graph will become closed by transitivity with respect to the edge Egde. In other words, any sucessors of the target node of 'edge' will become the target of an edge whose source is the source of 'edge' (method used for priority graphs for instance).

Parameters
edgean edge belonging to the Graph

◆ transitiveClosure() [2/2]

void Diades::Graph::Graph::transitiveClosure ( Edge  edge)

Transitive closure of a edge. This methods transforms the current graph so that the graph will become closed by transitivity with respect to the edge Egde. In other words, any sucessors of the target node of 'edge' will become the target of an edge whose source is the source of 'edge' (method used for priority graphs for instance).

Parameters
edgean edge belonging to the Graph

Referenced by empty(), and nodeCapacity().

◆ typeName()

static string Diades::Graph::Graph::typeName ( )
inlinestatic

Definition at line 178 of file GraphInt.hh.

◆ valid()

bool Diades::Graph::Graph::valid ( ) const
inline

◆ vEdges() [1/2]

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

Definition at line 210 of file GraphInt.hh.

References _vEdges.

◆ vEdges() [2/2]

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

Definition at line 226 of file GraphInt.hh.

References _vEdges.

◆ vNodes() [1/2]

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

Definition at line 214 of file GraphInt.hh.

References _vNodes.

◆ vNodes() [2/2]

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

Definition at line 230 of file GraphInt.hh.

References _vNodes.

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  os,
const Graph g 
)
friend

Definition at line 705 of file GraphIntOld.hh.

Member Data Documentation

◆ _data

GraphData* Diades::Graph::Graph::_data
private

◆ _id

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

Definition at line 197 of file GraphInt.hh.

Referenced by id(), and Diades::Automata::FaultPattern::EventOccurrence::identifier().

◆ _listEdgeId

list<EdgeSizeType> Diades::Graph::Graph::_listEdgeId
private

Definition at line 193 of file GraphInt.hh.

Referenced by listEdgeId().

◆ _listNodeId

list<NodeSizeType> Diades::Graph::Graph::_listNodeId
private

Definition at line 194 of file GraphInt.hh.

Referenced by listNodeId().

◆ _nbEdges

EdgeSizeType Diades::Graph::Graph::_nbEdges
private

Definition at line 196 of file GraphInt.hh.

Referenced by numberOfEdges().

◆ _nbNodes

NodeSizeType Diades::Graph::Graph::_nbNodes
private

Definition at line 195 of file GraphInt.hh.

Referenced by numberOfNodes().

◆ _vEdges

vector<Edge> Diades::Graph::Graph::_vEdges
mutableprivate

Definition at line 191 of file GraphInt.hh.

Referenced by vEdges().

◆ _vNodes

vector<Node> Diades::Graph::Graph::_vNodes
mutableprivate

Definition at line 192 of file GraphInt.hh.

Referenced by source(), sourceRef(), and vNodes().


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