     #(= data-type (:data/type %))
     #(= (count (::children %))
         (inc (count (::keys %))))))
+
+
+
+;; ## Branching Factor
+
+(def default-branching-factor
+  "The default number of children to limit each index node to."
+  256)
+
+
+(defn max-branches
+  "Return the maximum number of children a valid index node can have given the
+  parameters."
+  [params]
+  (::branching-factor params default-branching-factor))
+
+
+(defn min-branches
+  "Return the minimum number of children a valid index node must have given the
+  parameters."
+  [params]
+  (int (Math/ceil (/ (max-branches params) 2))))
 
 
 

          ; Result elements are a carry.
          :else
            (recur outputs result (next inputs))))

      ; No more input nodes.
      (if (seq outputs)
        (let [outputs (if carry

  "Value of `:data/type` that indicates an index tree node."
  :merkle-db/index)


;; The branching factor determines the number of children an index node in the
;; data tree can have.
