Class: Dumper_Dot

Inherits:
Dumper show all
Defined in:
lib/Yinspire/Dumpers/Dumper_Dot.rb

Overview

Dumper for the GraphViz dot format.

Only dumps the net, not the stimulis.

[1]: www.graphviz.org/

Instance Method Summary collapse

Methods inherited from Dumper

#dump_entities, #initialize

Constructor Details

This class inherits a constructor from Dumper

Instance Method Details

#dump(out) ⇒ Object

NOTE: Unconnected synapses are not shown.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/Yinspire/Dumpers/Dumper_Dot.rb', line 15

def dump(out)
  out << "digraph {\n"
  out << "node [shape = circle];\n"

  @entities.each_value {|entity|
    next unless entity.kind_of?(Neuron) 
    entity.each_connection do |syn|
      out << "#{entity.id.inspect} -> #{syn.post_neuron.id.inspect} [label = #{syn.id.inspect} ];\n"
    end
  }
  out << "}\n"
end