Networks

class networklogger.NetworkLogger[source]

Bases: object

NetworkLogger logs a network. It has to be initialized in start.py. In the agents log_network has to be called. Optionally log_agent, can be called in order to save agent attributes.

Simulation.network(frequency=1, savefig=False, savegml=True, figsize=(24, 20), dpi=100, pos_fixed=False, alpha=0.8)

network(.) prepares abce to write network data.

Args:
frequency:
the frequency with which the network is written, default=1
savefig:
wether to save a png file, default=False
savegml:
wether to save a gml file, default=True
figsize:
size of the graph in inch. (see matplotlib)
dpi:
resulution of the picture
pos_fixed:
positions are fixed after the first round

Example:

simulation.network(savefig=True)
log_agent(color='blue', style='filled', shape='circle')[source]

log_agent is optional. It can log agent attributes.

Args:
color:
matplotlib color, default=’blue’
shape:
shape can be one of the folling signs: ”.,ov^<>12348sp*hH+xDd|_” others can be found at http://matplotlib.org/api/markers_api.html
log_network(list_of_nodes)[source]

loggs a network. List of nodes is a list with the numbers of all agents, this agent is connected to.

Args:
list_of_nodes:
list of nodes that the agent is linked to. A list of noteds must have the following format: [(‘agent_group’, agent_id), (‘agent_group’, agent_id), ...] If your
color:
integer for the color
style(True/False):
filled or not
shape(True/False):
form of the bubble