A toolkit for working with phylogenetic data.
v0.20.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 59 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 75 of file path.hpp.

IteratorPath ( NodeType &  start,
NodeType &  finish 
)
inline

Definition at line 82 of file path.hpp.

IteratorPath ( LinkType &  start,
LinkType &  finish 
)
inline

Definition at line 86 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 281 of file path.hpp.

LinkType& finish_link ( ) const
inline

Definition at line 296 of file path.hpp.

NodeType& finish_node ( ) const
inline

Definition at line 301 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 258 of file path.hpp.

bool is_lca ( ) const
inline

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

Definition at line 266 of file path.hpp.

LinkType& link ( ) const
inline

Definition at line 271 of file path.hpp.

NodeType& node ( ) const
inline

Definition at line 276 of file path.hpp.

bool operator!= ( const self_type other) const
inline

Definition at line 231 of file path.hpp.

self_type operator* ( )
inline

Definition at line 196 of file path.hpp.

self_type operator++ ( )
inline

Definition at line 201 of file path.hpp.

self_type operator++ ( int  )
inline

Definition at line 217 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 224 of file path.hpp.

LinkType& start_link ( ) const
inline

Definition at line 286 of file path.hpp.

NodeType& start_node ( ) const
inline

Definition at line 291 of file path.hpp.

Member Typedef Documentation

using iterator_category = std::forward_iterator_tag

Definition at line 68 of file path.hpp.

using self_type = IteratorPath<LinkType, NodeType, EdgeType>

Definition at line 69 of file path.hpp.


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