40 #ifndef _BIPARTITIONLIST_H_ 41 #define _BIPARTITIONLIST_H_ 45 #include <Bpp/Utils/MapTools.h> 46 #include <Bpp/Numeric/Matrix/Matrix.h> 84 public virtual Clonable
109 BipartitionList(
const std::vector<std::string>& elements,
const std::vector<int*>& bipl);
123 #ifndef NO_VIRTUAL_COV 140 std::map<std::string, bool>
getBipartition(
size_t i)
const throw (Exception);
146 void addBipartition(std::map<std::string, bool>& bipart,
bool checkElements = 1) throw(Exception);
154 bool containsBipartition(std::map<std::string, bool>& bipart,
bool checkElements = 1)
const throw(Exception);
156 bool areIdentical(
size_t k1,
size_t k2) const throw(Exception);
168 bool areCompatible(
size_t k1,
size_t k2) const throw(Exception);
197 void flip(
size_t i) throw(Exception);
233 #endif //_BIPARTITIONLIST_H_ size_t getNumberOfBipartitions() const
BipartitionList & operator=(const BipartitionList &bipl)
Assignment operator.
RowMatrix< int > toMatrix() const
Create a matrix representation of the bifurcations.
bool haveSameElementsThan(std::map< std::string, bool > &bipart) const
bool areIdentical(size_t k1, size_t k2) const
int * getBitBipartition(size_t i)
void flip(size_t i)
Replaces ones by zeros and zeros by ones in the ith bipartition.
virtual ~BipartitionList()
void sortByPartitionSize()
Sort bipartitions by partition size.
bool areCompatible(size_t k1, size_t k2) const
Tells whether 2 bipartitions from the list are compatible.
The phylogenetic tree class.
std::map< std::string, bool > getBipartition(size_t i) const
Interface for phylogenetic tree objects.
TreeTemplate< Node > * toTree() const
Translate into a tree.
void removeRedundantBipartitions()
const std::vector< std::string > & getElementNames() 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.
void addTrivialBipartitions(bool checkExisting)
Adds bipartitions corresponding to external branches if missing.
bool areAllCompatible() const
Tells whether all bipartitions in the list are compatible with each other.
std::vector< std::string > elements_
bool containsBipartition(std::map< std::string, bool > &bipart, bool checkElements=1) const
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
BipartitionList * clone() const
BipartitionList(const Tree &tr, bool sorted=true, std::vector< int > *index=0)
The main contructor.
void removeTrivialBipartitions()
Removes bipartitions corresponding to external branches (1 vs n-1)
void addBipartition(std::map< std::string, bool > &bipart, bool checkElements=1)
size_t getNumberOfElements() const
The phylogenetic node class.
This class deals with the bipartitions defined by trees.
void deleteBipartition(size_t i)
std::vector< int * > bitBipartitionList_
size_t getPartitionSize(size_t i) const
Returns the size of the smallest of the two partitions (e.g. 1 for external branches) ...
const std::vector< int * > & getBitBipartitionList() const