PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
pbat::graph::DepthFirstSearch< TIndex > Struct Template Reference

Public Types

using IndexType = TIndex
 Index type used in the depth-first search.
 
using StackType = std::stack<IndexType, std::vector<IndexType>>
 Stack type used for DFS.
 

Public Member Functions

 DepthFirstSearch (Eigen::Index n)
 Construct a new Depth First Search object.
 
void Reserve (Eigen::Index n)
 Reserve memory for n vertices.
 
template<class FVisit, class TDerivedP, class TDerivedAdj>
void operator() (Eigen::DenseBase< TDerivedP > const &ptr, Eigen::DenseBase< TDerivedAdj > const &adj, TIndex start, FVisit fVisit)
 Perform depth-first search on the graph.
 
Eigen::Index NumVertices () const
 Get the number of vertices in the graph.
 

Public Attributes

Eigen::Vector< bool, Eigen::Dynamic > visited
 |# vertices| x 1 visited mask
 
StackType stack
 DFS search stack.
 

Constructor & Destructor Documentation

◆ DepthFirstSearch()

template<common::CIndex TIndex>
pbat::graph::DepthFirstSearch< TIndex >::DepthFirstSearch ( Eigen::Index n)
inline

Construct a new Depth First Search object.

Parameters
nNumber of vertices in the graph

Member Function Documentation

◆ NumVertices()

template<common::CIndex TIndex = Index>
Eigen::Index pbat::graph::DepthFirstSearch< TIndex >::NumVertices ( ) const
inline

Get the number of vertices in the graph.

Returns
Number of vertices

◆ operator()()

template<common::CIndex TIndex>
template<class FVisit, class TDerivedP, class TDerivedAdj>
void pbat::graph::DepthFirstSearch< TIndex >::operator() ( Eigen::DenseBase< TDerivedP > const & ptr,
Eigen::DenseBase< TDerivedAdj > const & adj,
TIndex start,
FVisit fVisit )
inline

Perform depth-first search on the graph.

Template Parameters
FVisitCallable type with signature void(IndexType)
TDerivedPType of the pointer vector (adjacency list start indices for each vertex)
TDerivedAdjType of the adjacency list (vector of vertex indices)
Parameters
ptrPointer to the start of each vertex's adjacency list
adjAdjacency list of the graph
startStarting vertex index
fVisitFunction to call for each visited vertex

◆ Reserve()

template<common::CIndex TIndex>
void pbat::graph::DepthFirstSearch< TIndex >::Reserve ( Eigen::Index n)
inline

Reserve memory for n vertices.

Parameters
nNumber of vertices in the graph

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