Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
quetzal::coalescence::container::Network< CellT > Class Template Reference

#include <quetzal/coalescence/container/Network.hpp>

Detailed Description

template<class CellT>
class quetzal::coalescence::container::Network< CellT >

Data structure for representing phylogenetic network topologies where each node contains a data field.

Template Parameters
CellTCell type, ie the value of the node. The requirements that are imposed on CellT depend on the actual operations performed on Network<CellT>.
Remarks
The network is still oriented, with a sense of root and leaves.
Extends the concept of Tree to the case of internal nodes having possibly several parents.
See also
Standardization of the Phylogenetic Network concept: https://doi.org/10.1186/1471-2105-9-532

Public Member Functions

 Network ()
 Default constructor.
 
 Network (const CellT &cell)
 Constructor with data copy.
 
 Network (CellT &&cell) noexcept
 Constructor with data move.
 
unsigned int nb_children () const
 Returns the number of children.
 
unsigned int nb_parents () const
 Returns the number of parents.
 
const CellT & cell () const
 Cell accessor.
 
CellT & cell ()
 Cell accessor.
 
Network< CellT > & add_child (CellT &&cell) noexcept
 Add a subnetwork to the children list of the network, initialize the network.
 
Network< CellT > & add_child (Network< CellT > &subnetwork)
 Add a sub-network to the children list of the network.
 
Network< CellT > & add_parent (Network< CellT > &parent)
 Add a itself as a sub-network in the list of the parent children.
 
bool has_parent () const
 Checks whether the network has a parent.
 
bool has_children () const
 Checks whether the network has one or more child.
 
template<typename UnaryOperation >
void visit_cell_by_pre_order_DFS (UnaryOperation op) const
 Applies a function object to the data member of each node encountered in a preorder depth first search algorithm.
 
template<class UnaryOperation >
void visit_by_pre_order_DFS (UnaryOperation op)
 Applies a function object to each node encountered in a depth first search algorithm.
 
template<typename Op1 , typename Op2 , typename Op3 >
void visit_by_generic_DFS (Op1 preorder, Op2 inorder, Op3 postorder)
 Applies a function object to each node encountered in a depth first search algorithm.
 
template<typename UnaryOperation >
void visit_leaves_cells_by_DFS (UnaryOperation op) const
 Applies a function object to the data member of each leave encountered along a depth first search algorithm.
 

Constructor & Destructor Documentation

◆ Network() [1/3]

template<class CellT >
quetzal::coalescence::container::Network< CellT >::Network ( )
inline

Default constructor.

Remarks
CellT must be default constructible

◆ Network() [2/3]

template<class CellT >
quetzal::coalescence::container::Network< CellT >::Network ( const CellT &  cell)
inline

Constructor with data copy.

Parameters
cellthe value of the network cell
Remarks
CellT must be copy constructible.

◆ Network() [3/3]

template<class CellT >
quetzal::coalescence::container::Network< CellT >::Network ( CellT &&  cell)
inlinenoexcept

Constructor with data move.

Parameters
cellthe value of the network cell
Remarks
CellT must be move constructible.

Member Function Documentation

◆ add_child() [1/2]

template<class CellT >
Network< CellT > & quetzal::coalescence::container::Network< CellT >::add_child ( CellT &&  cell)
inlinenoexcept

Add a subnetwork to the children list of the network, initialize the network.

Parameters
cellthe cell value of the subnetwork to be added
Returns
a reference on the new subnetwork

◆ add_child() [2/2]

template<class CellT >
Network< CellT > & quetzal::coalescence::container::Network< CellT >::add_child ( Network< CellT > &  subnetwork)
inline

Add a sub-network to the children list of the network.

Parameters
subtreethe subtree to be added
Returns
a reference on the added subtree

◆ add_parent()

template<class CellT >
Network< CellT > & quetzal::coalescence::container::Network< CellT >::add_parent ( Network< CellT > &  parent)
inline

Add a itself as a sub-network in the list of the parent children.

Parameters
subtreethe subtree to be added
Returns
a reference on the added subtree

◆ cell() [1/2]

template<class CellT >
CellT & quetzal::coalescence::container::Network< CellT >::cell ( )
inline

Cell accessor.

Returns
a reference to the network cell
Remarks
Read-and-write data access

◆ cell() [2/2]

template<class CellT >
const CellT & quetzal::coalescence::container::Network< CellT >::cell ( ) const
inline

Cell accessor.

Returns
a const-reference to the network cell
Remarks
Read-only data access

◆ has_children()

template<class CellT >
bool quetzal::coalescence::container::Network< CellT >::has_children ( ) const
inline

Checks whether the network has one or more child.

Returns
Returns false if the network has no child, else returns true.

◆ has_parent()

template<class CellT >
bool quetzal::coalescence::container::Network< CellT >::has_parent ( ) const
inline

Checks whether the network has a parent.

Returns
Returns true if the network has a parent, else returns false.

◆ visit_by_generic_DFS()

template<class CellT >
template<typename Op1 , typename Op2 , typename Op3 >
void quetzal::coalescence::container::Network< CellT >::visit_by_generic_DFS ( Op1  preorder,
Op2  inorder,
Op3  postorder 
)
inline

Applies a function object to each node encountered in a depth first search algorithm.

Parameters
preorderunary operation function object that will be applied to every node of the network. The unary operator takes the node as argument. The signature of the function should be equivalent to the following: void op(Network & node);.
inorderunary operation function object that will be applied to every node of the network. The unary operator takes the node as argument. The signature of the function should be equivalent to the following: void op(Network & node);.
postorderunary operation function object that will be applied to every node of the network. The unary operator takes the node as argument. The signature of the function should be equivalent to the following: void op(Network & node);.

◆ visit_by_pre_order_DFS()

template<class CellT >
template<class UnaryOperation >
void quetzal::coalescence::container::Network< CellT >::visit_by_pre_order_DFS ( UnaryOperation  op)
inline

Applies a function object to each node encountered in a depth first search algorithm.

Parameters
opunary operation function object that will be applied to every node of the network. The unary operator takes the node as argument. The signature of the function should be equivalent to the following: void op(Network & node);.

◆ visit_cell_by_pre_order_DFS()

template<class CellT >
template<typename UnaryOperation >
void quetzal::coalescence::container::Network< CellT >::visit_cell_by_pre_order_DFS ( UnaryOperation  op) const
inline

Applies a function object to the data member of each node encountered in a preorder depth first search algorithm.

Parameters
opunary operation function object that will be applied to the data member of the network. The unary operator takes the cell as argument. The signature of the function should be equivalent to the following: void op(const CellT & cell);.

◆ visit_leaves_cells_by_DFS()

template<class CellT >
template<typename UnaryOperation >
void quetzal::coalescence::container::Network< CellT >::visit_leaves_cells_by_DFS ( UnaryOperation  op) const
inline

Applies a function object to the data member of each leave encountered along a depth first search algorithm.

Parameters
opunary operation function object that will be applied to the data member of the network. The unary operator takes the cell as argument. The signature of the function should be equivalent to the following: void op(const CellT & cell);.

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