class NoSE::Random::WattsStrogatzNetwork

Generates a random graph using the Watts-Strogatz model

Public Class Methods

new(params = {}) click to toggle source
Calls superclass method NoSE::Random::Network::new
# File lib/nose/random/watts_strogatz.rb, line 7
def initialize(params = {})
  super params

  @beta = params.fetch :beta, 0.5
  @node_degree = params.fetch :node_degree, 2
  @nodes = 0..(@nodes_nb - 1)

  @entities = @nodes.map do |node|
    create_entity node
  end

  build_initial_links
  rewire_links
  add_foreign_keys
end

Private Instance Methods