<commit_before>class Node
  attr_reader :id

  def initialize(graph, id, label, style)
    @graph = graph
    @id = id
    @label = label
    @style = style
  end

  def generate_dot
    "#{@id} [label=#{@label.inspect} #{@style}];"
  end

  #
  # DSL methods
  #

  def edge(other_node, style)
    @graph.edge(self, other_node, style)
  end

  def member(person)
    person.edge(self, '')
  end

  def guest(person)
    person.edge(self, 'style=dotted label=guest')
  end
end

class Edge
  def initialize(graph, source, target, style)
    @graph = graph
    @source = source
    @target = target
    @style = style
  end

  def generate_dot
    "#{@source.id} -> #{@target.id} [#{@style}];"
  end
end

class Graph
  def initialize
    @next_id = 0
    @nodes = []
    @edges = []
  end

  def next_id
    id = "_#{@next_id}"
    @next_id += 1
    id
  end

  def generate_dot
    dot = "digraph {\n"

    attributes = {
      layout: 'sfdp',
      sep: '"+10,10"',
      overlap: 'false',
      splines: 'true',
    }

    attributes.each do |attr, val|
      dot.concat("  #{attr}=#{val};\n")
    end

    @nodes.each do |node|
      dot.concat("  #{node.generate_dot}\n")
    end

    @edges.each do |edge|
      dot.concat("  #{edge.generate_dot}\n")
    end

    dot.concat('}')
  end

  #
  # DSL methods
  #

  def node(label, style)
    node = Node.new(self, next_id, label, style)
    @nodes.push(node)
    node
  end

  def band(name)
    node(name, 'shape=box')
  end

  def person(name)
    node(name, '')
  end

  def edge(source, target, style)
    edge = Edge.new(self, source, target, style)
    @edges.push(edge)
    edge
  end
end

g = Graph.new

_68            = g.band "'68"
alice_cooper   = g.band '<NAME>'
annihilator    = g.band 'Annihilator'
as_cities_burn = g.band 'As Cities Burn'
dream_theater  = g.band 'Dream Theater'
geology        = g.band 'Geology'
listener       = g.band 'Listener'
megadeth       = g.band 'Megadeth'
metallica      = g.band 'Metallica'
mwy            = g.band 'mewithoutYou'
norma_jean     = g.band '<NAME>'
paramore       = g.band 'Paramore'
queens_club    = g.band 'Queens Club'
savatage       = g.band 'Savatage'
the_chariot    = g.band 'The Chariot'
tso            = g.band 'Trans-Siberian Orchestra'

a_pitrelli  = g.person '<NAME>'
a_weiss     = g.person '<NAME>'
d_eaton     = g.person '<NAME>'
d_mustaine  = g.person '<NAME>'
d_sherinian = g.person '<NAME>'
d_smith     = g.person '<NAME>'
g_jehanian  = g.person '<NAME>'
h_williams  = g.person '<NAME>'
j_degrasso  = g.person '<NAME>'
j_ryan      = g.person '<NAME>'
j_scogin    = g.person '<NAME>'
j_waters    = g.person '<NAME>'
m_mangini   = g.person '<NAME>'

_68.member j_scogin
alice_cooper.member a_pitrelli
alice_cooper.member d_sherinian
alice_cooper.member j_degrasso
annihilator.member j_waters
annihilator.member m_mangini
as_cities_burn.guest j_scogin
dream_theater.member d_sherinian
dream_theater.member m_mangini
geology.member g_jehanian
listener.member d_smith
megadeth.member a_pitrelli
megadeth.member d_mustaine
megadeth.member j_degrasso
metallica.member d_mustaine
mwy.guest h_williams
mwy.member a_weiss
mwy.member g_jehanian
norma_jean.guest a_weiss
norma_jean.member j_scogin
paramore.member h_williams
queens_club.member d_eaton
queens_club.member j_ryan
savatage.guest j_waters
savatage.member a_pitrelli
the_chariot.guest a_weiss
the_chariot.guest d_smith
the_chariot.guest h_williams
the_chariot.member d_eaton
the_chariot.member j_ryan
the_chariot.member j_scogin
tso.member a_pitrelli

puts g.generate_dot<commit_msg>Swap from firstinitial_lastname to lastname_firstinitial.<commit_after>class Node
  attr_reader :id

  def initialize(graph, id, label, style)
    @graph = graph
    @id = id
    @label = label
    @style = style
  end

  def generate_dot
    "#{@id} [label=#{@label.inspect} #{@style}];"
  end

  #
  # DSL methods
  #

  def edge(other_node, style)
    @graph.edge(self, other_node, style)
  end

  def member(person)
    person.edge(self, '')
  end

  def guest(person)
    person.edge(self, 'style=dotted label=guest')
  end
end

class Edge
  def initialize(graph, source, target, style)
    @graph = graph
    @source = source
    @target = target
    @style = style
  end

  def generate_dot
    "#{@source.id} -> #{@target.id} [#{@style}];"
  end
end

class Graph
  def initialize
    @next_id = 0
    @nodes = []
    @edges = []
  end

  def next_id
    id = "_#{@next_id}"
    @next_id += 1
    id
  end

  def generate_dot
    dot = "digraph {\n"

    attributes = {
      layout: 'sfdp',
      sep: '"+10,10"',
      overlap: 'false',
      splines: 'true',
    }

    attributes.each do |attr, val|
      dot.concat("  #{attr}=#{val};\n")
    end

    @nodes.each do |node|
      dot.concat("  #{node.generate_dot}\n")
    end

    @edges.each do |edge|
      dot.concat("  #{edge.generate_dot}\n")
    end

    dot.concat('}')
  end

  #
  # DSL methods
  #

  def node(label, style)
    node = Node.new(self, next_id, label, style)
    @nodes.push(node)
    node
  end

  def band(name)
    node(name, 'shape=box')
  end

  def person(name)
    node(name, '')
  end

  def edge(source, target, style)
    edge = Edge.new(self, source, target, style)
    @edges.push(edge)
    edge
  end
end

g = Graph.new

_68            = g.band "'68"
alice_cooper   = g.band '<NAME>'
annihilator    = g.band 'Annihilator'
as_cities_burn = g.band 'As Cities Burn'
dream_theater  = g.band 'Dream Theater'
geology        = g.band 'Geology'
listener       = g.band 'Listener'
megadeth       = g.band 'Megadeth'
metallica      = g.band 'Metallica'
mwy            = g.band 'mewithoutYou'
norma_jean     = g.band 'Norma Jean'
paramore       = g.band 'Paramore'
queens_club    = g.band 'Queens Club'
savatage       = g.band 'Savatage'
the_chariot    = g.band 'The Chariot'
tso            = g.band 'Trans-Siberian Orchestra'

degrasso_j  = g.person '<NAME>'
eaton_d     = g.person '<NAME>'
jehanian_g  = g.person '<NAME>'
mangini_m   = g.person '<NAME>'
mustaine_d  = g.person '<NAME>'
pitrelli_a  = g.person '<NAME>'
ryan_j      = g.person '<NAME>'
scogin_j    = g.person '<NAME>'
sherinian_d = g.person '<NAME>'
smith_d     = g.person '<NAME>'
waters_j    = g.person '<NAME>'
weiss_a     = g.person '<NAME>'
williams_h  = g.person '<NAME>'

_68.member scogin_j
alice_cooper.member degrasso_j
alice_cooper.member pitrelli_a
alice_cooper.member sherinian_d
annihilator.member mangini_m
annihilator.member waters_j
as_cities_burn.guest scogin_j
dream_theater.member mangini_m
dream_theater.member sherinian_d
geology.member jehanian_g
listener.member smith_d
megadeth.member degrasso_j
megadeth.member mustaine_d
megadeth.member pitrelli_a
metallica.member mustaine_d
mwy.guest williams_h
mwy.member jehanian_g
mwy.member weiss_a
norma_jean.guest weiss_a
norma_jean.member scogin_j
paramore.member williams_h
queens_club.member eaton_d
queens_club.member ryan_j
savatage.guest waters_j
savatage.member pitrelli_a
the_chariot.guest smith_d
the_chariot.guest weiss_a
the_chariot.guest williams_h
the_chariot.member eaton_d
the_chariot.member ryan_j
the_chariot.member scogin_j
tso.member pitrelli_a

puts g.generate_dot
{'fraction_non_alphanumeric': 0.11987161596427574, 'fraction_numerical': 0.0033491487580240022, 'mean_word_length': 3.121334100057504, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 34, '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': '5742057', 'n_tokens_mistral': 2888, 'n_tokens_neox': 2805, 'n_words': 634}