![]() |
fpmas 1.6
|
#include <graph.h>
Public Types | |
typedef NodeType::IdType | NodeIdType |
typedef EdgeType::IdType | EdgeIdType |
typedef fpmas::api::graph::IdHash< typename NodeType::IdType > | NodeIdHash |
typedef fpmas::api::graph::IdHash< typename EdgeType::IdType > | EdgeIdHash |
typedef std::unordered_map< NodeIdType, NodeType *, NodeIdHash > | NodeMap |
typedef std::unordered_map< EdgeIdType, EdgeType *, EdgeIdHash > | EdgeMap |
Public Member Functions | |
virtual void | insert (NodeType *node)=0 |
virtual void | insert (EdgeType *edge)=0 |
virtual void | erase (NodeType *node)=0 |
virtual void | erase (EdgeType *edge)=0 |
virtual void | addCallOnInsertNode (api::utils::Callback< NodeType * > *callback)=0 |
virtual std::vector< api::utils::Callback< NodeType * > * > | onInsertNodeCallbacks () const =0 |
virtual void | addCallOnEraseNode (api::utils::Callback< NodeType * > *callback)=0 |
virtual std::vector< api::utils::Callback< NodeType * > * > | onEraseNodeCallbacks () const =0 |
virtual void | addCallOnInsertEdge (api::utils::Callback< EdgeType * > *callback)=0 |
virtual std::vector< api::utils::Callback< EdgeType * > * > | onInsertEdgeCallbacks () const =0 |
virtual void | addCallOnEraseEdge (api::utils::Callback< EdgeType * > *callback)=0 |
virtual std::vector< api::utils::Callback< EdgeType * > * > | onEraseEdgeCallbacks () const =0 |
virtual NodeType * | getNode (NodeIdType id)=0 |
virtual const NodeType * | getNode (NodeIdType id) const =0 |
virtual const NodeMap & | getNodes () const =0 |
virtual EdgeType * | getEdge (EdgeIdType id)=0 |
virtual const EdgeType * | getEdge (EdgeIdType) const =0 |
virtual const EdgeMap & | getEdges () const =0 |
virtual void | clear ()=0 |
Graph API
typedef NodeType::IdType fpmas::api::graph::Graph< NodeType, EdgeType >::NodeIdType |
Node ID type
typedef EdgeType::IdType fpmas::api::graph::Graph< NodeType, EdgeType >::EdgeIdType |
Edge ID type
typedef fpmas::api::graph::IdHash<typename NodeType::IdType> fpmas::api::graph::Graph< NodeType, EdgeType >::NodeIdHash |
Node ID hash function
typedef fpmas::api::graph::IdHash<typename EdgeType::IdType> fpmas::api::graph::Graph< NodeType, EdgeType >::EdgeIdHash |
Edge ID hash function
typedef std::unordered_map< NodeIdType, NodeType*, NodeIdHash > fpmas::api::graph::Graph< NodeType, EdgeType >::NodeMap |
Node map type
typedef std::unordered_map< EdgeIdType, EdgeType*, EdgeIdHash > fpmas::api::graph::Graph< NodeType, EdgeType >::EdgeMap |
Edge map type
|
pure virtual |
Inserts a Node into the graph.
Upon return, the NodeMap returned by getNodes() must contain an entry {node->getId(), node}
.
Callbacks registered using addCallOnInsertNode() are also called after the node has effectively been inserted into the graph.
node | pointer to node to insert in the graph |
Implemented in fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >, and fpmas::graph::Graph< NodeType, EdgeType >.
|
pure virtual |
Inserts an Edge into the graph.
Upon return, the EdgeMap returned by getEdges() must contain an entry {edge->getId(), edge}
.
Callbacks registered using addCallOnInsertEdge() are also called after the edge has effectively been inserted into the graph.
edge | pointer to edge to insert in the graph |
Implemented in fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >, and fpmas::graph::Graph< NodeType, EdgeType >.
|
pure virtual |
Erases a previously inserted node from the graph.
Upon return, the entry {node->getId(), node}
must not be contained anymore in the NodeMap returned by getNodes().
Moreover, all incoming and outgoing edges, as returned by Node::getIncomingEdges and Node::getOutgoingEdges, should also be erased from the Graph, as specified by the erase(EdgeType*) function.
Callbacks registered using addCallOnEraseNode() are also called after the node has effectively been removed from the graph.
Erasing a node not contained in the Graph produces an unexpected behavior.
node | node to erase from the graph |
Implemented in fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >, and fpmas::graph::Graph< NodeType, EdgeType >.
|
pure virtual |
Erases a previously inserted edge from the graph.
Upon return, the entry {edge->getId(), edge}
must not be contained anymore in the NodeMap returned by getEdges().
Callbacks registered using addCallOnEraseEdge() are also called after the edge has effectively been removed from the graph.
Erasing an edge not contained in the Graph produces an unexpected behavior.
edge | edge to erase from the graph |
Implemented in fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >, and fpmas::graph::Graph< NodeType, EdgeType >.
|
pure virtual |
Adds an insert node callback, called on insert(NodeType*).
callback | insert node callback |
Implemented in fpmas::graph::Graph< NodeType, EdgeType >.
|
pure virtual |
Current insert node callbacks list.
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.
|
pure virtual |
Adds an erase node callback, called on erase(NodeType*).
callback | insert node callback |
Implemented in fpmas::graph::Graph< NodeType, EdgeType >.
|
pure virtual |
Current erase node callbacks list.
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.
|
pure virtual |
Adds an insert edge callback, called on insert(EdgeType*).
callback | insert edge callback |
Implemented in fpmas::graph::Graph< NodeType, EdgeType >.
|
pure virtual |
Current insert edge callbacks list.
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.
|
pure virtual |
Adds an erase edge callback, called on erase(EdgeType*).
callback | erase edge callback |
Implemented in fpmas::graph::Graph< NodeType, EdgeType >.
|
pure virtual |
Current erase edge callbacks list.
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.
|
pure virtual |
Gets the pointer to the node associated to the given id in the Graph.
The returned pointer must correspond to the entry {id, node}
contained in the NodeMap returned by getNodes().
If id does not correspond to a node contained in the graph, behavior is unspecified.
id | node id |
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.
|
pure virtual |
Gets the pointer to the node associated to the given id in the Graph.
The returned pointer must correspond to the entry {id, node}
contained in the NodeMap returned by getNodes().
If id does not correspond to a node contained in the graph, behavior is unspecified.
id | node id |
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.
|
pure virtual |
NodeMap representing the nodes contained in this graph.
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.
|
pure virtual |
Gets the pointer to the edge associated to the given id in the Graph.
The returned pointer must correspond to the entry {id, edge}
contained in the EdgeMap returned by getEdges().
If id does not correspond to an edge contained in the graph, behavior is unspecified.
id | edge id |
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.
|
pure virtual |
|
pure virtual |
EdgeMap representing the edges contained in this graph.
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.
|
pure virtual |
Erases all nodes and edges contained in the graph.
All erase node and erase edge callbacks must be called properly for each item.
Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.