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

#include <tpl_graph_utils.H>

Public Member Functions

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

Detailed Description

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

Generic functor for depth first traversal of a graph.

This functor class traverses a graph in depth 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

◆ Depth_First_Traversal()

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

Construct a depth first traversal whose arcs are filtered by s filtro de arcos del iterador interno.

Member Function Documentation

◆ operator()() [1/2]

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

Invoke to traversal starting on any node of graph

Parameters
[in]gthe graph
[in]opvisit operation
Returns
the number of visited nodes

◆ operator()() [2/2]

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

Invoke to traversal starting on any node of graph

Parameters
[in]gthe graph
[in]snpointer to starting node
[in]opvisit operation
Returns
the number of visited nodes

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

Leandro Rabindranath León