A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IteratorPath< LinkType, NodeType, EdgeType > Class Template Reference

#include <genesis/tree/iterator/path.hpp>

Detailed Description

template<typename LinkType, typename NodeType, typename EdgeType>
class genesis::tree::IteratorPath< LinkType, NodeType, EdgeType >

Definition at line 58 of file path.hpp.

Public Member Functions

 IteratorPath ()
 
 IteratorPath (NodeType &start, NodeType &finish)
 
 IteratorPath (LinkType &start, LinkType &finish)
 
 IteratorPath (IteratorPath const &)=default
 
 IteratorPath (IteratorPath &&)=default
 
 ~IteratorPath ()=default
 
EdgeType & edge () const
 
LinkType & finish_link () const
 
NodeType & finish_node () const
 
bool is_last_common_ancestor () const
 Return whether the current iterator position (node) is the last common ancestor of the two start and finish nodes. More...
 
bool is_lca () const
 Alias for is_last_common_ancestor(). See there for more information. More...
 
LinkType & link () const
 
NodeType & node () const
 
bool operator!= (const self_type &other) const
 
self_type operator* ()
 
self_type operator++ ()
 
self_type operator++ (int)
 
IteratorPathoperator= (IteratorPath const &)=default
 
IteratorPathoperator= (IteratorPath &&)=default
 
bool operator== (const self_type &other) const
 
LinkType & start_link () const
 
NodeType & start_node () const
 

Public Types

using iterator_category = std::forward_iterator_tag
 
using self_type = IteratorPath< LinkType, NodeType, EdgeType >
 

Constructor & Destructor Documentation

IteratorPath ( )
inline

Definition at line 74 of file path.hpp.

IteratorPath ( NodeType &  start,
NodeType &  finish 
)
inline

Definition at line 81 of file path.hpp.

IteratorPath ( LinkType &  start,
LinkType &  finish 
)
inline

Definition at line 85 of file path.hpp.

~IteratorPath ( )
default
IteratorPath ( IteratorPath< LinkType, NodeType, EdgeType > const &  )
default
IteratorPath ( IteratorPath< LinkType, NodeType, EdgeType > &&  )
default

Member Function Documentation

EdgeType& edge ( ) const
inline

Definition at line 280 of file path.hpp.

LinkType& finish_link ( ) const
inline

Definition at line 295 of file path.hpp.

NodeType& finish_node ( ) const
inline

Definition at line 300 of file path.hpp.

bool is_last_common_ancestor ( ) const
inline

Return whether the current iterator position (node) is the last common ancestor of the two start and finish nodes.

This is useful in many cases:

  • Find the LCA (obviously).
  • Check when the path is moving away from the root again.
  • Iterating edges instead of nodes.

The last bullet point may need some explanation:

The iterator visits all nodes between the start and the finish (both included). On the path between them, there is however one edge fewer than the number of visited nodes. That means, if you want to visit each edge on the path between two nodes (instead of each node), you need a way to spot this superflous edge. This function indicates the edge that needs to be skipped in this case.

Definition at line 257 of file path.hpp.

bool is_lca ( ) const
inline

Alias for is_last_common_ancestor(). See there for more information.

Definition at line 265 of file path.hpp.

LinkType& link ( ) const
inline

Definition at line 270 of file path.hpp.

NodeType& node ( ) const
inline

Definition at line 275 of file path.hpp.

bool operator!= ( const self_type other) const
inline

Definition at line 230 of file path.hpp.

self_type operator* ( )
inline

Definition at line 195 of file path.hpp.

self_type operator++ ( )
inline

Definition at line 200 of file path.hpp.

self_type operator++ ( int  )
inline

Definition at line 216 of file path.hpp.

IteratorPath& operator= ( IteratorPath< LinkType, NodeType, EdgeType > const &  )
default
IteratorPath& operator= ( IteratorPath< LinkType, NodeType, EdgeType > &&  )
default
bool operator== ( const self_type other) const
inline

Definition at line 223 of file path.hpp.

LinkType& start_link ( ) const
inline

Definition at line 285 of file path.hpp.

NodeType& start_node ( ) const
inline

Definition at line 290 of file path.hpp.

Member Typedef Documentation

using iterator_category = std::forward_iterator_tag

Definition at line 67 of file path.hpp.

using self_type = IteratorPath<LinkType, NodeType, EdgeType>

Definition at line 68 of file path.hpp.


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