Aleph-w  1.9
General library for algorithms and data structures
Aleph::Breadth_First_Traversal< GT, Operation, SA > Class Template Reference

#include <tpl_graph_utils.H>

Public Member Functions

 Breadth_First_Traversal (SA __sa=SA())
 
size_t operator() (const GT &g, Operation op)
 
size_t operator() (const GT &g, typename GT::Node *p, Operation &&op=Operation())
 
size_t operator() (const GT &g, typename GT::Node *p, Operation &op)
 

Detailed Description

template<class GT, class Operation = Default_Visit_Op<GT>, class SA = Dft_Show_Arc<GT>>
class Aleph::Breadth_First_Traversal< GT, Operation, SA >

Generic functor for breadth first traversal of a graph.

This functor class traverses a graph in breadth first order and by each seen node it is called an operation.

The functor receives the following template parameters;

  1. GT: the graph type
  2. Operation: functor for the visit operation,
  3. SA: arc filter

Operation functor must match the following signature:

struct Operation
{
  bool operator () (const GT & g, typename GT::Node * node, 
                    typename GT::Arc * arc)
    {

return true if you want to stop the traversal } };

G is the graph, node is the current visited node and arc is the arc from which the current node was seen. If the operator returns true, then the traversal stops; otherwise this continues.

The control bit Depth_First is used both the nodes and arcs

@see breadth_first_traversal() test_connectivity() Filter_Iterator

Constructor & Destructor Documentation

◆ Breadth_First_Traversal()

template<class GT , class Operation = Default_Visit_Op<GT>, class SA = Dft_Show_Arc<GT>>
Aleph::Breadth_First_Traversal< GT, Operation, SA >::Breadth_First_Traversal ( SA  __sa = SA())
inline

Constructor of functor Breadth_First_Traversal whose arcs are filtered by sa

Member Function Documentation

◆ operator()() [1/2]

template<class GT , class Operation = Default_Visit_Op<GT>, class SA = Dft_Show_Arc<GT>>
size_t Aleph::Breadth_First_Traversal< GT, Operation, SA >::operator() ( const GT &  g,
Operation  op 
)
inline

Invoke to traversal.

Parameters
[in]gthe graph
[in]opvisit operation
Returns
number of visited nodes
Exceptions
bad_allocif there is no enough memory

◆ operator()() [2/2]

template<class GT , class Operation = Default_Visit_Op<GT>, class SA = Dft_Show_Arc<GT>>
size_t Aleph::Breadth_First_Traversal< GT, Operation, SA >::operator() ( const GT &  g,
typename GT::Node *  p,
Operation &&  op = Operation() 
)
inline

Invoke to traversal.

Parameters
[in]gthe graph
[in]ppointer to starting node
[in]opvisit operation
Returns
number of visited nodes
Exceptions
bad_allocif there is no enough memory

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

Leandro Rabindranath León