<commit_before>(ns frontend.components.pieces.map
  (:require [clojure.string :as string]
            [loom.alg :as alg]
            [loom.graph :as g])
  (:require-macros
   [devcards.core :as dc :refer [defcard]]
   [frontend.utils :refer [html]]))

(defn roots [g]
  (filter (comp zero? (partial g/in-degree g)) (g/nodes g)))

(defn ranks [g]
  (->> {:remaining-graph g}
       (iterate (fn [{g :remaining-graph}]
                  {:rank (roots g)
                   :remaining-graph (g/remove-nodes* g (roots g))}))
       (drop 1)
       (map :rank)
       (take-while seq)))

(defn transitive-reduction [g]
  (reduce<commit_msg>Fix a frontend.utils warning<commit_after>(ns frontend.components.pieces.map
  (:require [clojure.string :as string]
            [frontend.utils :refer-macros [html]]
            [loom.alg :as alg]
            [loom.graph :as g])
  (:require-macros
   [devcards.core :as dc :refer [defcard]]))

(defn roots [g]
  (filter (comp zero? (partial g/in-degree g)) (g/nodes g)))

(defn ranks [g]
  (->> {:remaining-graph g}
       (iterate (fn [{g :remaining-graph}]
                  {:rank (roots g)
                   :remaining-graph (g/remove-nodes* g (roots g))}))
       (drop 1)
       (map :rank)
       (take-while seq)))

(defn transitive-reduction [g]
  (reduce
{'fraction_non_alphanumeric': 0.16448885472713298, 'fraction_numerical': 0.0015372790161414297, 'mean_word_length': 2.347043701799486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2263917', 'n_tokens_mistral': 476, 'n_tokens_neox': 457, 'n_words': 120}