11#ifndef NETWORK_H_INCLUDED
12#define NETWORK_H_INCLUDED
38 std::vector<Network<CellT>> m_parents;
39 std::vector<Network<CellT>> m_children;
47 Network() : m_parents(), m_cell(), m_children()
67 Network(CellT &&
cell) noexcept : m_parents(), m_cell(std::move(
cell)), m_children()
75 return m_children.size();
82 return m_parents.size();
118 m_children.push_back(std::move(subnetwork));
119 return m_children.back();
131 m_children.push_back(subnetwork);
132 return m_children.back();
143 m_parents.push_back(parent);
144 return m_parents.back();
153 return !m_parents.empty();
162 return !m_children.empty();
176 for (
auto const &child : this->m_children)
178 child.visit_cells_by_pre_order_DFS(op);
192 for (
auto &child : this->m_children)
194 child.visit_by_pre_order_DFS(op);
215 template <
typename Op1,
typename Op2,
typename Op3>
219 for (
auto &child : this->m_children)
221 child.visit_by_generic_DFS(preorder, inorder, postorder);
239 for (
auto const &child : this->m_children)
241 child.visit_leaves_cells_by_DFS(op);
Data structure for representing phylogenetic network topologies where each node contains a data field...
Definition Network.hpp:35
Network< CellT > & add_child(CellT &&cell) noexcept
Add a subnetwork to the children list of the network, initialize the network.
Definition Network.hpp:114
const CellT & cell() const
Cell accessor.
Definition Network.hpp:91
unsigned int nb_parents() const
Returns the number of parents.
Definition Network.hpp:80
bool has_children() const
Checks whether the network has one or more child.
Definition Network.hpp:160
CellT & cell()
Cell accessor.
Definition Network.hpp:102
Network< CellT > & add_child(Network< CellT > &subnetwork)
Add a sub-network to the children list of the network.
Definition Network.hpp:128
Network(const CellT &cell)
Constructor with data copy.
Definition Network.hpp:57
unsigned int nb_children() const
Returns the number of children.
Definition Network.hpp:73
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 alg...
Definition Network.hpp:235
Network()
Default constructor.
Definition Network.hpp:47
Network(CellT &&cell) noexcept
Constructor with data move.
Definition Network.hpp:67
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 searc...
Definition Network.hpp:173
bool has_parent() const
Checks whether the network has a parent.
Definition Network.hpp:151
void visit_by_pre_order_DFS(UnaryOperation op)
Applies a function object to each node encountered in a depth first search algorithm.
Definition Network.hpp:189
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.
Definition Network.hpp:216
Network< CellT > & add_parent(Network< CellT > &parent)
Add a itself as a sub-network in the list of the parent children.
Definition Network.hpp:141
Simulation of coalescence-based models of molecular evolution.
Definition coalescence.hpp:21