module documentation

This module contains methods to initialize and compute metrics for a scale free simulation.

Function build_scale_free_network Organizes buyers and communities into a scale free network structure.
Function get_normalization_factor Computes the normalization factor of the dictionary's values.
Function initialize_scale_free Initializes a scale free network world.
Function make_sf_graph_info_file Creates an information file (.csv) for this scale free experiment.
Function remove_zeroes Removes dictionary pairs with values equal to zero.
Function safe_normalize Normalizes values in dictionary.
def build_scale_free_network(set_of_nodes, G, community_bonus, logger, epoch, all_buyers_in_market):

Organizes buyers and communities into a scale free network structure.

Parameters
set_of_nodesrandom subset of buyers
Ggraph representing initial market state
community_bonusbonus to purchase probability from being in the same community
loggerlogging object
epochcurrent epoch (for logger)
all_buyers_in_marketlist of all buyers in market
Returns
graph representing initial market state in scale free structure
def get_normalization_factor(dictionary):

Computes the normalization factor of the dictionary's values.

Parameters
dictionaryinput dictionary object
Returns
normalization factor of the dictionary's values
def initialize_scale_free(number_of_buyers, minimum_number_of_communities, minimum_community_fill, assemblage, initial_set_size, community_bonus, logger):

Initializes a scale free network world.

Parameters
number_of_buyersnumber of buyers in marketspace
minimum_number_of_communitiesminimum number of communities to which buyers belong
minimum_community_fillminimum number of buyers per community
assemblagelist of items for sale in marketspace
initial_set_sizenumber of buyers in market at initialization
community_bonusdegree to which community affiliation impacts purchase intention
loggerlogging object
def make_sf_graph_info_file(num_buyers, min_num_communities, min_community_fill, assemblage, epochs, upper_thresh, lower_thresh, death_thresh, results_dir, community_bonus, initial_set_size, set_size):

Creates an information file (.csv) for this scale free experiment.

Parameters
num_buyersnumber of buyers in market
min_num_communitiesminimum number of communities
min_community_fillminimum number of buyers per community
assemblagelist of items for sale in market
epochsnumber of market iterations
upper_thresh% of buyers that must own a particular item to change a buyer's intention to that item
lower_threshmax % of buyers that may own a particular item to change a buyer's intention to random item
death_threshpercentage at which a pot is removed from the market
results_dirdirectory path in which to store the file
community_bonusdegree to which community affiliation impacts purchase intention
initial_set_sizenumber of buyers in market at initialization
set_sizenumber of buyers added to market after initialization
def remove_zeroes(dictionary):

Removes dictionary pairs with values equal to zero.

Parameters
dictionaryinput dictionary object
Returns
dictionary with zero value pairs removed
def safe_normalize(dictionary):

Normalizes values in dictionary.

Parameters
dictionarydictionary with non-normalized values
Returns
dictionary with normalized values