"reprod" (Reproducible Opinion Dynamics)

Common structures and functions (odCommon)

Main.odCommon.Agent — Type
Agent

Type representing a single agent in an environment, with its own opinion(s).

Fields

  • opinion_array::Array{Opinion, 1}: the current opinion(s) of this agent.
source
Main.odCommon.make_graph — Method
function make_graph(n=20, p=0.2)

Create and return a random connected Erdos-Renyi graph with $n$ nodes and probability $p$ that any two nodes are neighbors.

source
Main.odCommon.set_opinion — Method
function set_opinion(graph, node_list, agent_list, random_influencer::Bool,
replacement::Bool)

Choose an agent at random from the environment, and change its (or one of its randomly chosen graph neighbor's) opinion to match the neighbor (or agent).

Arguments

  • graph, node_list, agent_list: the current state of the simulation, as embodied in the graph and agent states.

  • random_influencer: if true, the randomly-chosen agent will influence (change the opinion of) its randomly-chosen graph neighbor. Otherwise, the neighbor will change it.

  • replacement: if true, puts back the last randomly selected node in the list of next nodes that can be selected. If false, takes out the last randomly selected node from the list of next nodes that can be selected.

source