def prepare_filename_graph!
      @filename_graph = {}
      @encountered_graph.each do |filename, encountered_classes|
        dependent_class_names =
          if @definition_graph[filename].nil?
            encountered_classes
          else
            class_names_defined_in_file = @definition_graph[filename].keys
            # all superclass names that this file depends on
            class_names_dependent_by_superclass = @definition_graph[filename].values.compact - class_names_defined_in_file
            class_names_dependent_by_use = encountered_classes - class_names_defined_in_file
            class_names_dependent_by_superclass + class_names_dependent_by_use
          end
        dependent_class_names.each do |dep|
          dependent_definition_fname = @definition_graph.detect { |fname, hash| hash.has_key?(dep) }.first rescue nil
          if dependent_definition_fname
            @filename_graph[filename] ||= []
            unless @filename_graph[filename].include?(dependent_definition_fname)
              @filename_graph[filename] << dependent_definition_fname
            end
          end
        end
      end
    end
def prepare_filename_graph!
      @filename_graph = {}
      @encountered_graph.each do |filename, encountered_classes|
        dependent_class_names =
          if @definition_graph[filename].nil?
            encountered_classes
          else
            class_names_defined_in_file = @definition_graph[filename].keys
            # all superclass names that this file depends on
            class_names_dependent_by_superclass = @definition_graph[filename].values.compact - class_names_defined_in_file
            class_names_dependent_by_use = encountered_classes - class_names_defined_in_file
            class_names_dependent_by_superclass + class_names_dependent_by_use
          end
        dependent_class_names.each do |dep|
          dependent_definition_fname = @definition_graph.detect { |fname, hash| hash.has_key?(dep) }.first rescue nil
          if dependent_definition_fname
            @filename_graph[filename] ||= []
            unless @filename_graph[filename].include?(dependent_definition_fname)
              @filename_graph[filename] << dependent_definition_fname
            end
          end
        end
      end
    end
Computes `@filename_graph` from `@encountered_graph` and `@definition_graph`.
 This graph is used by `tsort` to sort the filenames for inclusion.