"reprod" (Reproducible Opinion Dynamics)
Common structures and functions (odCommon
)
Main.odCommon.Agent
— TypeAgent
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.
Main.odCommon.make_graph
— Methodfunction 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.
Main.odCommon.set_opinion
— Methodfunction 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
: iftrue
, the randomly-chosen agent will influence (change the opinion of) its randomly-chosen graph neighbor. Otherwise, the neighbor will change it.replacement
: iftrue
, puts back the last randomly selected node in the list of next nodes that can be selected. Iffalse
, takes out the last randomly selected node from the list of next nodes that can be selected.