5 #ifndef BPP_PHYL_TREE_BIPARTITIONLIST_H
6 #define BPP_PHYL_TREE_BIPARTITIONLIST_H
20 template<
class N>
class TreeTemplate;
71 BipartitionList(
const std::vector<std::string>& elements,
const std::vector<int*>& bipl);
102 void addBipartition(std::map<std::string, bool>& bipart,
bool checkElements = 1);
110 bool containsBipartition(std::map<std::string, bool>& bipart,
bool checkElements = 1)
const;
137 bool areAllCompatibleWith(std::map<std::string, bool>& bipart,
bool checkElements =
true)
const;
168 std::unique_ptr<TreeTemplate<Node>>
toTree()
const;
182 std::vector<std::string>
buildBitBipartitions(
const Node* nd, std::vector<int*>& bitbip,
const std::vector<std::string>& elements,
size_t* cpt, std::vector<int>* index)
const;
This class deals with the bipartitions defined by trees.
void addTrivialBipartitions(bool checkExisting)
Adds bipartitions corresponding to external branches if missing.
std::vector< int * > bitBipartitionList_
void flip(size_t i)
Replaces ones by zeros and zeros by ones in the ith bipartition.
void sortByPartitionSize()
Sort bipartitions by partition size.
void addBipartition(std::map< std::string, bool > &bipart, bool checkElements=1)
bool containsBipartition(std::map< std::string, bool > &bipart, bool checkElements=1) const
size_t getNumberOfElements() const
bool haveSameElementsThan(std::map< std::string, bool > &bipart) const
std::vector< std::string > elements_
std::map< std::string, bool > getBipartition(size_t i) const
void removeTrivialBipartitions()
Removes bipartitions corresponding to external branches (1 vs n-1)
std::unique_ptr< TreeTemplate< Node > > toTree() const
Translate into a tree.
BipartitionList(const Tree &tr, bool sorted=true, std::vector< int > *index=0)
The main constructor.
BipartitionList * clone() const
size_t getPartitionSize(size_t i) const
Returns the size of the smallest of the two partitions (e.g. 1 for external branches)
bool areIdentical(size_t k1, size_t k2) const
RowMatrix< int > toMatrix() const
Create a matrix representation of the bifurcations.
bool areCompatible(size_t k1, size_t k2) const
Tells whether 2 bipartitions from the list are compatible.
virtual ~BipartitionList()
size_t getNumberOfBipartitions() const
BipartitionList & operator=(const BipartitionList &bipl)
Assignment operator.
int * getBitBipartition(size_t i)
void removeRedundantBipartitions()
const std::vector< std::string > & getElementNames() const
const std::vector< int * > & getBitBipartitionList() const
void deleteBipartition(size_t i)
bool areAllCompatible() const
Tells whether all bipartitions in the list are compatible with each other.
std::vector< std::string > buildBitBipartitions(const Node *nd, std::vector< int * > &bitbip, const std::vector< std::string > &elements, size_t *cpt, std::vector< int > *index) const
bool areAllCompatibleWith(std::map< std::string, bool > &bipart, bool checkElements=true) const
Tells whether all bipartitions in the list are compatible with a given bipartition.
The phylogenetic node class.
Interface for phylogenetic tree objects.
Defines the basic types of data flow nodes.