Class sdm::GraphNode
template <typename TNode typename TNode, typename TEdge typename TEdge>
Class List > sdm > GraphNode
Node of graphs. More...
#include <graph_node.hpp>
Inherits the following classes: std::enable_shared_from_this< GraphNode< TNode, TEdge > >, sdm::BoostSerializable
Public Attributes
Type | Name |
---|---|
TNode | data_ data of the current node |
std::unordered_map< TEdge, std::weak_ptr< GraphNode > > | predecessors List of predecessors. |
std::unordered_map< TEdge, std::weak_ptr< GraphNode > > | successors The map from edge value to successor. |
Public Functions
Type | Name |
---|---|
GraphNode () Default constructor object. | |
GraphNode (const TNode & data) Construct a graph with an initial node*. | |
void | addPredecessor (const TEdge & edge_value, const std::shared_ptr< GraphNode > & node_value) Add a predecessor to the current node. |
void | addSuccessor (const TEdge & edge_value, const std::shared_ptr< GraphNode > & node_value) Add a successor node. |
TNode && | data () const |
TNode | getData () const Get the value of the current node. |
number | getNumPredecessors () const Get the number of predecessors. |
number | getNumSuccessors () const Get the number of successors. |
std::shared_ptr< GraphNode > | getPredecessor (const TEdge & edge) const Get the set of all predecessors. |
std::shared_ptr< GraphNode > | getSuccessor (const TEdge & edge) const Get the successor following a given edge. |
std::shared_ptr< GraphNode > | getptr () |
void | serialize (Archive & archive, const unsigned int) |
void | setData (const TNode & data) |
std::string | str () const |
virtual | ~GraphNode () Destructor of GraphNode . |
Public Functions inherited from sdm::BoostSerializable
Type | Name |
---|---|
BoostSerializable () | |
void | load (std::string filename) Load a value function from a file. The extension of the file will indicate the type of formatage for reading ( .txt = text format, '.xml' = XML format, other = binary format). |
void | save (std::string filename) Save a value function into a file. The extension of the file will indicate the type of formatage for recording ( .txt = text format, '.xml' = XML format, other = binary format). |
Protected Functions inherited from sdm::BoostSerializable
Type | Name |
---|---|
void | serialize (Archive & archive, const unsigned int version) |
Detailed Description
GraphNode class is provide to give the user the possibility to transit directly on them. In fact, the class keep all the successors of a node in its attribute.
Template parameters:
TNode
the type of the data contains in each nodeTEdge
the type of the edges between two nodes
Public Attributes Documentation
variable data_
TNode sdm::GraphNode< TNode, TEdge >::data_;
variable predecessors
std::unordered_map<TEdge, std::weak_ptr<GraphNode> > sdm::GraphNode< TNode, TEdge >::predecessors;
variable successors
std::unordered_map<TEdge, std::weak_ptr<GraphNode> > sdm::GraphNode< TNode, TEdge >::successors;
Public Functions Documentation
function GraphNode [1/2]
sdm::GraphNode::GraphNode ()
function GraphNode [2/2]
sdm::GraphNode::GraphNode (
const TNode & data
)
Parameters:
data
function addPredecessor
void sdm::GraphNode::addPredecessor (
const TEdge & edge_value,
const std::shared_ptr< GraphNode > & node_value
)
Parameters:
node_value
the predecessor node value
function addSuccessor
void sdm::GraphNode::addSuccessor (
const TEdge & edge_value,
const std::shared_ptr< GraphNode > & node_value
)
Parameters:
edge
the edgenode
the successor node value
function data
TNode && sdm::GraphNode::data () const
function getData
TNode sdm::GraphNode::getData () const
Returns:
the address of the value
function getNumPredecessors
number sdm::GraphNode::getNumPredecessors () const
function getNumSuccessors
number sdm::GraphNode::getNumSuccessors () const
function getPredecessor
std::shared_ptr< GraphNode > sdm::GraphNode::getPredecessor (
const TEdge & edge
) const
Returns:
the set of predecessors
function getSuccessor
std::shared_ptr< GraphNode > sdm::GraphNode::getSuccessor (
const TEdge & edge
) const
Parameters:
edge
a specific edge
Returns:
the address of the successor's node
function getptr
std::shared_ptr< GraphNode > sdm::GraphNode::getptr ()
function serialize
template<class Archive class Archive>
void sdm::GraphNode::serialize (
Archive & archive,
const unsigned int
)
function setData
void sdm::GraphNode::setData (
const TNode & data
)
function str
std::string sdm::GraphNode::str () const
function ~GraphNode
virtual sdm::GraphNode::~GraphNode ()
Friends Documentation
friend operator<<
inline friend std::ostream & sdm::GraphNode::operator<< (
std::ostream & os,
GraphNode & graph
)
The documentation for this class was generated from the following file src/sdm/utils/struct/graph_node.hpp