          loc tree]
     (if (zip/end? loc)
       {:size size
+       :source (-> (zip/root tree) :source)
        :height max-path}
       (recur
        (if (zip/node loc) (inc size) size)

            [clj-time.periodic :as p]
            [clojure.pprint :refer [pprint]]
            [opennlp.nlp :refer [make-tokenizer make-detokenizer]]
            [incanter.stats :refer [mean variance quantile]]
            [loom.graph :as lg]
            [loom.io :as lio]
            [ceres.collector :refer [db custom-formatter news-accounts store]])

          (take 25)
          (map (fn [[k v]] [(:screen_name (mc/find-map-by-id @db "users" k))
                           v])))]))


(defn create-d3-graph
  "Converts zipper into d3 readable format"
  [tree]
  (loop [counter 0
         types {}
         nodes []
         links []
         loc tree]
    (if (zip/end? loc)
      {:nodes nodes
       :types types
       :links links}
      (recur
       (if (zip/node loc)
         (inc counter)
         counter)
       (if-let [node (zip/node loc)]
         (assoc types (-> node :source :_id str) (-> node :source :type))
         types)
       (if-let [node (zip/node loc)]
         (conj nodes (-> node :source :_id str))
         nodes)
       (if-let [node (zip/node loc)]
         (if-not (= node (zip/root tree))
           (conj links {:source counter :target (.indexOf nodes (-> loc zip/up zip/node :source :_id str))})
           links)
         links)
       (zip/next loc)))))


(comment
