root/trunk/CONSENSUS_TREE/CT_hash.hxx

Revision 8507, 1.4 KB (checked in by westram, 2 months ago)
  • use double for weights ([0..1] instead of [0..10000])
  • added tests using weights != 1
    • fixed weight/length calculation to make generated consense tree independent from used weight (as long as the same weight is used for all added trees)
  • no longer generates zero-bootstrap at root
    • strictly speaking it is wrong now (since the edge from virtual root to tree cant exist, ergo it's probability should be zero)
    • practically
      • that zero probability would be a special case (and is an error at all other edges)
      • a probability of 100% is used (which gets skipped when saving the tree)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : CT_hash.hxx                                       //
4//   Purpose   :                                                   //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#ifndef CT_HASH_HXX
12#define CT_HASH_HXX
13
14#ifndef CT_PART_HXX
15#include "CT_part.hxx"
16#endif
17#ifndef _GLIBCXX_SET
18#include <set>
19#endif
20#ifndef _GLIBCXX_VECTOR
21#include <vector>
22#endif
23
24typedef PART *PARTptr;
25typedef std::set<PARTptr, bool (*)(const PART *, const PART *)> PartSet;
26typedef std::vector<PARTptr> PartVector;
27
28inline bool topological_less(const PART *p1, const PART *p2) { return p1->topological_cmp(p2)<0; }
29
30class PartRegistry : virtual Noncopyable {
31    PartSet    parts;
32    PartVector sorted;
33    size_t     retrieved;
34
35public:
36    PartRegistry()
37        : parts(topological_less), 
38          retrieved(0)
39    {}
40
41    void  put_part(PART*& part);
42    void  build_sorted_list(double overall_weight);
43    PART *get_part();
44};
45
46#else
47#error CT_hash.hxx included twice
48#endif // CT_HASH_HXX
Note: See TracBrowser for help on using the browser.