netechos.core¶
Core functionality for the network echos model.
NetworkModel(number_of_nodes, interaction_type, alpha=1, beta=0.001)
¶
Object containing network model parameters and methods.
Object storing network model data and methods.
| PARAMETER | DESCRIPTION |
|---|---|
number_of_nodes
|
Number of nodes to add to the network model.
TYPE:
|
interaction_type
|
Type of interaction between nodes. If "symmetric" interactions will be reciprocated. If "asymmetric", interactions may be one-directional.
TYPE:
|
alpha
|
Exponent of the adjacency matrix during attitude reinforcement.
TYPE:
|
beta
|
Factor governing the rate of attitude change. Smaller values slow attitude change.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
An instance of the NetworkModel object.
TYPE:
|
Source code in src/netechos/core.py
compute_attitude_difference_matrix()
¶
Construct matrix of differences between node attitudes.
create_network(network_type, p=0.1, k=2, m=1.0)
¶
Create initial social network.
| PARAMETER | DESCRIPTION |
|---|---|
network_type
|
Type of network to create.
TYPE:
|
p
|
Required if network_type is one of 'erdos_renyi', 'watts_strogatz', 'newman_watts_strogatz'. Probability for edge creation.
TYPE:
|
k
|
Required if network_type is one of 'watts_strogatz',
'newman_watts_strogatz'. Each node is joined with its
TYPE:
|
m
|
Required if network_type is 'barabasi_albert'. Number of edges to attach from a new node to existing nodes.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
An instance of the NetworkModel object.
TYPE:
|
Source code in src/netechos/core.py
initialize_attitude_tracker()
¶
initialize_attitudes(distribution='vonmises', a=0.0, b=5)
¶
Set initial node attitudes.
| PARAMETER | DESCRIPTION |
|---|---|
distribution
|
Type of probability distribution to sample attitudes from.
TYPE:
|
a
|
First parameter for
TYPE:
|
b
|
Second parameter for
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
An instance of the NetworkModel object.
TYPE:
|
Source code in src/netechos/core.py
initialize_connections(neighbor_weight=1.0, non_neighbor_weight=0.0)
¶
Set initial network edge weights.
| PARAMETER | DESCRIPTION |
|---|---|
neighbor_weight
|
The weight to assign to edges between nodes which have an existing edge in the initial network.
TYPE:
|
non_neighbor_weight
|
The weight to assign to edges between nodes which don't have an existing edge in the initial network. If non-zero the network will technically become a complete network.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
An instance of the NetworkModel object.
TYPE:
|
Source code in src/netechos/core.py
initialize_summary_table()
¶
Initialize summary table.
Source code in src/netechos/core.py
make_asymmetric_interactions()
¶
Construct a random asymmetric adjacency matrix.
Source code in src/netechos/core.py
make_interactions()
¶
Construct interaction matrix.
Source code in src/netechos/core.py
make_symmetric_interactions()
¶
Construct a random symmetric adjacency matrix.
Source code in src/netechos/core.py
run_simulation(tmax)
¶
Simulate interaction and attitude reinforcement over time.
| PARAMETER | DESCRIPTION |
|---|---|
tmax
|
Number of time steps to iterate over.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
An instance of the NetworkModel object.
TYPE:
|
Source code in src/netechos/core.py
update_attitude_tracker(time)
¶
Construct attitude tracking table for one time.
| PARAMETER | DESCRIPTION |
|---|---|
time
|
Time index. Will be assigned to all rows of the
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
An instance of the NetworkModel object.
TYPE:
|
Source code in src/netechos/core.py
update_attitudes()
¶
Calculate change in attitude.
Source code in src/netechos/core.py
update_connections()
¶
Calculate change in connection strength.
Source code in src/netechos/core.py
update_summary_table(time)
¶
Construct summary of the network at one time.
| PARAMETER | DESCRIPTION |
|---|---|
time
|
Time index. Will be assigned to all rows of the
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
An instance of the NetworkModel object.
TYPE:
|