Module: NEAT::Graph

Included in:
Neuron
Defined in:
lib/rubyneat/graph.rb

Overview

General graph representation (mainly used for Neurons, but could be used for other structures.)

This is a mixin for Neuron and whatever else you'd like. the contained class is for evaluation, and may be instantiated separately.

Defined Under Namespace

Classes: DependencyResolver, GraphException

Instance Method Summary (collapse)

Instance Method Details

- (Object) <<(input)



19
20
21
22
# File 'lib/rubyneat/graph.rb', line 19

def << (input)
  @g_inputs << input
  self
end

- (Object) add(input)

Add a single input



25
26
27
# File 'lib/rubyneat/graph.rb', line 25

def add (input)
  @g_inputs << input
end

- (Object) clear_graph

clear and initialize the graph.



15
16
17
# File 'lib/rubyneat/graph.rb', line 15

def clear_graph
  @g_inputs = []
end

- (Object) inputs

Get list of inputs



30
31
32
33
# File 'lib/rubyneat/graph.rb', line 30

def inputs
  raise GraphException.new "Graph Failure -- input is nil" if @g_inputs.nil?
  @g_inputs
end