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

Node for graphs implemented with simple adjacency lists. More...

#include <tpl_sgraph.H>

Inheritance diagram for Aleph::Graph_Snode< Node_Info >:
[legend]
Collaboration diagram for Aleph::Graph_Snode< Node_Info >:
[legend]

Public Types

using Base = GTNodeCommon< 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_Snode (const Node_Info &info)
 Constructor that assigns an attribute value.
 
 Graph_Snode (Node_Info &&info=Node_Info())
 
 Graph_Snode (const Graph_Snode &node)
 
Graph_Snodeoperator= (const Graph_Snode &node)
 
 Graph_Snode (Graph_Snode *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

DynList< void * > arc_list
 Adjacency list of arcs incident to this node.
 
- 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 >
 

Detailed Description

template<typename Node_Info = Empty_Class>
struct Aleph::Graph_Snode< Node_Info >

Node for graphs implemented with simple adjacency lists.

This class defines a node or vertex of a graph or digraph implemented using singly-linked adjacency lists.

There are basically three ways to define the information that belongs to a graph node:

  • Through the type parameter inherent to the node called Node_Info.
  • Through inheritance from this base class. This is the way to maintain different node types in a graph.
  • A combination of the above two.
Template Parameters
Node_InfoData type stored in the node and accessible via the get_info() method.
Note
This class is only intended for defining graph nodes. It is not intended to be used directly by users. It is preferable to use it through the methods provided by List_SGraph. While it is possible to use some methods or access some of its attributes, it is highly recommended not to use them directly. Instead, use the List_SGraph::Node type and its associated methods.

A graph node has three additional attributes present for each node, named as follows:

  • Control bits (Bit_Fields): set of bits used by algorithms to mark the node.
  • Counter (counter): counter generally used to mark a visit or processing order.
  • cookie: opaque pointer to any other temporary information to be associated with the node.
See also
List_SGraph List_SDigraph Graph_Sarc Bit_Fields

Definition at line 92 of file tpl_sgraph.H.

Member Typedef Documentation

◆ Base

template<typename Node_Info = Empty_Class>
using Aleph::Graph_Snode< Node_Info >::Base = GTNodeCommon<Node_Info>

Definition at line 94 of file tpl_sgraph.H.

Constructor & Destructor Documentation

◆ Graph_Snode() [1/4]

template<typename Node_Info = Empty_Class>
Aleph::Graph_Snode< Node_Info >::Graph_Snode ( const Node_Info &  info)
inline

Constructor that assigns an attribute value.

Creates a node and assigns the value info as the information contained in the node.

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

Parameters
[in]infoThe information value to assign to the newly created node.
Note
The copy constructor of the Node_Info class must be defined.

Definition at line 112 of file tpl_sgraph.H.

◆ Graph_Snode() [2/4]

template<typename Node_Info = Empty_Class>
Aleph::Graph_Snode< Node_Info >::Graph_Snode ( Node_Info &&  info = Node_Info())
inline

Definition at line 118 of file tpl_sgraph.H.

◆ Graph_Snode() [3/4]

template<typename Node_Info = Empty_Class>
Aleph::Graph_Snode< Node_Info >::Graph_Snode ( const Graph_Snode< Node_Info > &  node)
inline

Definition at line 124 of file tpl_sgraph.H.

◆ Graph_Snode() [4/4]

template<typename Node_Info = Empty_Class>
Aleph::Graph_Snode< Node_Info >::Graph_Snode ( Graph_Snode< Node_Info > *  node)
inline

Copy constructor from a node pointer.

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

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

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

Definition at line 152 of file tpl_sgraph.H.

Member Function Documentation

◆ operator=()

template<typename Node_Info = Empty_Class>
Graph_Snode & Aleph::Graph_Snode< Node_Info >::operator= ( const Graph_Snode< Node_Info > &  node)
inline

Definition at line 130 of file tpl_sgraph.H.

References GTNodeCommon< NodeInfo >::node_info.

Friends And Related Symbol Documentation

◆ GTNodeCommon< Node_Info >

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

Definition at line 1 of file tpl_sgraph.H.

Member Data Documentation

◆ arc_list

template<typename Node_Info = Empty_Class>
DynList<void *> Aleph::Graph_Snode< Node_Info >::arc_list

Adjacency list of arcs incident to this node.

Definition at line 97 of file tpl_sgraph.H.

Referenced by TEST(), and TEST().


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