 (defn lifetime
   "Computes lifetime of contact set"
   [cs]
-  (let [sorted-cs (sort-by :ts cs)]
-    (t/in-seconds (t/interval (last cs) (first cs)))))
+  (zipmap
+   (keys cs)
+   (map
+    #(let [sorted-cs (sort-by :ts %)]
+       (-> (t/interval (-> % first :ts) (-> % last :ts))
+           t/in-seconds
+           (/ 3600)
+           float))
+    (vals cs))))
 
 
 (defn density

    :publications "pubs"
    :cascades cascades
    :assignments "tagrefs"
    :unrelated))



      first
      count)

  (aprint (zipmap
           (range 3 28)
           (map
            #(mc/count @db "messages" {:ts {$gt (t/date-time 2015 4 %)
                                            $lt (t/date-time 2015 4 (inc %))}})
            (range 3 28))))

  (-> (dynamic-expansion :contacts (t/date-time 2015 4 3) (t/date-time 2015 4 28))
      subset-size
      aprint)

  (-> (dynamic-expansion :unknown (t/date-time 2015 4 3) (t/date-time 2015 4 28))
      lifetime
      aprint)

  (-> (dynamic-expansion :nodes (t/date-time 2015 4 3) (t/date-time 2015 4 28))
      lifetime
      aprint)

  )
