Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Graph_Node< __Node_Info > Struct Template Reference

Node belonging to a graph implemented with a double linked adjacency list. More...

#include <tpl_graph.H>

Inheritance diagram for Aleph::Graph_Node< __Node_Info >:
[legend]
Collaboration diagram for Aleph::Graph_Node< __Node_Info >:
[legend]

Public Types

using Base = GTNodeCommon< __Node_Info >
 
using Node_Info = __Node_Info
 
- Public Types inherited from GTNodeCommon< NodeInfo >
using Item_Type = NodeInfo
 
using Node = GTNodeCommon
 Common alias for set types.
 
using Node_Type = NodeInfo
 The node.
 

Public Member Functions

 Graph_Node (const Node_Info &info) noexcept
 The type of data stored in the node.
 
 Graph_Node (Node_Info &&info=Node_Info()) noexcept
 Move or rvalue constructor.
 
 Graph_Node (const Graph_Node &node) noexcept
 
Graph_Nodeoperator= (const Graph_Node &node)
 
 Graph_Node (Graph_Node *node)
 Copy constructor from a node pointer.
 
- Public Member Functions inherited from GTNodeCommon< NodeInfo >
 GTNodeCommon () noexcept=default
 another alias for set type
 
 GTNodeCommon (const NodeInfo &info)
 Copy constructor from info value.
 
 GTNodeCommon (NodeInfo &&info)
 Move constructor from info value.
 
 GTNodeCommon (const GTNodeCommon &other)
 Copy constructor.
 
 GTNodeCommon (GTNodeCommon &&other) noexcept
 Move constructor.
 
GTNodeCommonoperator= (const GTNodeCommon &other)
 Copy assignment operator.
 
GTNodeCommonoperator= (GTNodeCommon &&other) noexcept
 Move assignment operator.
 
NodeInfoget_info () noexcept
 Return a modifiable reference to the data contained in the node.
 
const NodeInfoget_info () const noexcept
 Return a constant reference to the data contained in the node.
 
unsigned int state () const noexcept
 Return the state's value.
 
void set_state (unsigned int s) noexcept
 Set the state to value s
 

Public Attributes

Dlink arc_list
 
- Public Attributes inherited from GTNodeCommon< NodeInfo >
Graph_Attr attrs
 Attributes of node.
 
NodeInfo node_info
 
size_t num_arcs = 0
 data associated to the node. Access it with get_info()
 

Friends

class GTNodeCommon< __Node_Info >
 
class Arc_Node
 

Additional Inherited Members

Detailed Description

template<typename __Node_Info = Empty_Class>
struct Aleph::Graph_Node< __Node_Info >

Node belonging to a graph implemented with a double linked adjacency list.

This class is used for defining a node of the graph implemented with double-linked adjacency lists.

Basically, there are three ways for defining the information to be stored in a node:

  1. Specifying the data as a template parameter of this class.
  2. By inheriting from this class and in the derived class to define the data
  3. Combination of two above
Note
The purpose of this class is only for specifying the node of a graph. It is not intended for declaration. Use the internal node subclass instead. Although you could access data and function members of this class, at the exception to get_info() it is not advisable to use them. They are accessible for implementation purposes.
A node has three additional attributes: the control bits, the counter and the cookie.
See also
List_Graph List_Digraph Graph_Arc Bit_Fields

Definition at line 118 of file tpl_graph.H.

Member Typedef Documentation

◆ Base

Definition at line 125 of file tpl_graph.H.

◆ Node_Info

template<typename __Node_Info = Empty_Class>
using Aleph::Graph_Node< __Node_Info >::Node_Info = __Node_Info

Definition at line 126 of file tpl_graph.H.

Constructor & Destructor Documentation

◆ Graph_Node() [1/4]

template<typename __Node_Info = Empty_Class>
Aleph::Graph_Node< __Node_Info >::Graph_Node ( const Node_Info info)
inlinenoexcept

The type of data stored in the node.

Copy constructor.

Construct a node whose data is copied from info. The control attributes are reset.

Parameters
[in]infodata to copy to the node
Note
The copy constructor of Node_Info must be defined

Definition at line 137 of file tpl_graph.H.

◆ Graph_Node() [2/4]

template<typename __Node_Info = Empty_Class>
Aleph::Graph_Node< __Node_Info >::Graph_Node ( Node_Info &&  info = Node_Info())
inlinenoexcept

Move or rvalue constructor.

Construct a node whose data is moved from info. The control attributes are reset.

Parameters
[in]infodata to move to the node
Note
The move constructor of Node_Info must be defined

Definition at line 150 of file tpl_graph.H.

◆ Graph_Node() [3/4]

template<typename __Node_Info = Empty_Class>
Aleph::Graph_Node< __Node_Info >::Graph_Node ( const Graph_Node< __Node_Info > &  node)
inlinenoexcept

Definition at line 156 of file tpl_graph.H.

◆ Graph_Node() [4/4]

template<typename __Node_Info = Empty_Class>
Aleph::Graph_Node< __Node_Info >::Graph_Node ( Graph_Node< __Node_Info > *  node)
inline

Copy constructor from a node pointer.

Creates a node and assigns node->get_info() as the value of the information contained in the node.

The control bits and the counter values are set to zero. The cookie is set to nullptr.

Parameters
[in]nodepointer to the node from which the information value to be assigned to the newly created node is copied.
Note
The copy constructor of the Node_Info class must be defined.
The created instance is a different node from node.

Definition at line 184 of file tpl_graph.H.

Member Function Documentation

◆ operator=()

Definition at line 162 of file tpl_graph.H.

References GTNodeCommon< NodeInfo >::node_info.

Friends And Related Symbol Documentation

◆ Arc_Node

template<typename __Node_Info = Empty_Class>
friend class Arc_Node
friend

Definition at line 123 of file tpl_graph.H.

◆ GTNodeCommon< __Node_Info >

template<typename __Node_Info = Empty_Class>
friend class GTNodeCommon< __Node_Info >
friend

Definition at line 3843 of file tpl_graph.H.

Member Data Documentation

◆ arc_list

template<typename __Node_Info = Empty_Class>
Dlink Aleph::Graph_Node< __Node_Info >::arc_list

Definition at line 190 of file tpl_graph.H.


The documentation for this struct was generated from the following file: