From 2e939ab085d079315cd3e5282ef9d5a3ed682deb Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Mon, 27 Oct 2014 17:23:53 +0100
Subject: [PATCH] Fix bug in LeafHistogram::getDistribOutOfConnectedComponent.

---
 src/graph/statistics.cc | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/graph/statistics.cc b/src/graph/statistics.cc
index a0fc376..30a53ad 100644
--- a/src/graph/statistics.cc
+++ b/src/graph/statistics.cc
@@ -219,24 +219,12 @@ namespace hpp {
           const core::ConnectedComponentPtr_t& cc) const
       {
         statistics::DiscreteDistribution < core::NodePtr_t > distrib;
-        typedef std::pair < core::NodePtr_t, unsigned int > Element;
-        std::list <Element> elemts;
-        unsigned int M = 0;
         for (const_iterator bin = begin(); bin != end (); bin++) {
           unsigned int w = bin->numberOfObsOutOfConnectedComponent (cc);
           if (w == 0)
             continue;
-          elemts.push_back (Element (bin->nodes ().front (), bin->numberOfObsOutOfConnectedComponent (cc)));
-          if (elemts.back ().second > M)
-            M = elemts.back ().second;
+          distrib.insert (bin->nodes ().front (), w);
         }
-        if (elemts.size () == 1)
-          distrib.insert (elemts.back ().first, elemts.back ().second);
-        else
-          while (!elemts.empty ()) {
-            distrib.insert (elemts.back ().first, M - elemts.back ().second);
-            elemts.pop_back ();
-          }
         return distrib;
       }
 
-- 
GitLab