[Avida-SVN] r2038 - development/source/analyze

kaben at myxo.css.msu.edu kaben at myxo.css.msu.edu
Sun Sep 2 17:48:07 PDT 2007


Author: kaben
Date: 2007-09-02 20:48:07 -0400 (Sun, 02 Sep 2007)
New Revision: 2038

Modified:
   development/source/analyze/cAnalyzeGenotypeTreeStats.cc
Log:
Fix bug in class cAnalyzeGenotypeTreeStats where tree nodes with one child node were considered branch nodes.


Modified: development/source/analyze/cAnalyzeGenotypeTreeStats.cc
===================================================================
--- development/source/analyze/cAnalyzeGenotypeTreeStats.cc	2007-09-02 19:36:23 UTC (rev 2037)
+++ development/source/analyze/cAnalyzeGenotypeTreeStats.cc	2007-09-03 00:48:07 UTC (rev 2038)
@@ -171,20 +171,28 @@
   // compute number of subtree nodes.
   int branch_tree_size = 0;
   for (int pos = 0; pos < num_gens; pos++) {
-    if(m_agl[pos].offspring_count != 1){
+    //if(m_agl[pos].offspring_count != 1){
+    if(m_agl[pos].offspring_count > 1){
       branch_tree_size++;
     }
   }
   if (m_world->GetVerbosity() >= VERBOSE_ON) {
     cout << "Number of n-furcating nodes: " << branch_tree_size << endl;
   }
+  if (branch_tree_size <= 0){
+    if (m_world->GetVerbosity() >= VERBOSE_ON) {
+      cerr << "Error: no branches found in tree - " << endl;
+    }
+    return;
+  }
 
   m_agl2.Resize(branch_tree_size);  // Store agl data for each id.
   tHashTable<int, int> id_hash_2;
   int array_pos_2 = 0;
   if (true) for (int pos = 0; pos < num_gens; pos++) {
     int offs_count = m_agl[pos].offspring_count;
-    if (offs_count != 1){
+    //if (offs_count != 1){
+    if (offs_count > 1){
       m_agl2[array_pos_2].id = m_agl[pos].id;
       m_agl2[array_pos_2].pid = m_agl[pos].pid;
       m_agl2[array_pos_2].depth = m_agl[pos].depth;
@@ -254,7 +262,7 @@
   DFS of branch tree, to accumulate branch distances. {{{4
   */
   if (m_world->GetVerbosity() >= VERBOSE_ON) {
-    cout << "Finding root of n-furcating subtree..." << endl;
+    cout << "Accumulating branch distances..." << endl;
   }
   tList<cAGLData> dfs_stack;
   if(0 != root){




More information about the Avida-cvs mailing list