<commit_before>require 'tsort'
module Sower

  # This is the main class to draw the relationships between nodes.
  # It is a directed graph so that we can topologically use strongly connected components.
  # Nodes can then be sorted by their relationships.
  class Graph

    class NodeDoesNotExistError < StandardError # :nodoc:
      def initialize(n = nil)
        m = "node <%s> does not exist" % n.inspect
        super(m)
      end
    end

    include TSort

    attr_reader :edges

    def initialize # :nodoc:
      @nodes = {}
      @edges = Hash.new({})
    end

    # Iterate through each node of the Graph<commit_msg>When invoking @edges[key] it is instanciated as a Hash<commit_after>require 'tsort'
module Sower

  # This is the main class to draw the relationships between nodes.
  # It is a directed graph so that we can topologically use strongly connected components.
  # Nodes can then be sorted by their relationships.
  class Graph

    class NodeDoesNotExistError < StandardError # :nodoc:
      def initialize(n = nil)
        m = "node <%s> does not exist" % n.inspect
        super(m)
      end
    end

    include TSort

    attr_reader :edges

    def initialize # :nodoc:
      @nodes = {}
      @edges = Hash.new{|h,k| h[k] = {}}
    end

    # Iterate through each node of the Graph
{'fraction_non_alphanumeric': 0.07382039573820395, 'fraction_numerical': 0.0, 'mean_word_length': 2.6731843575418996, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '3903668', 'n_tokens_mistral': 391, 'n_tokens_neox': 376, 'n_words': 156}