module documentation
This module implements support methods for the control experiments for both the small world and scale free network protocols. This includes initialization methods and information file generation. This file is the equivalent of `scalefree.py` and `smallworld.py` for control simulations.
| Function | build |
Constructs a control network for a scale-free network simulation. |
| Function | initialize |
No summary |
| Function | make |
Construct a random graph. |
| Function | make |
Creates an information file (.csv) for this control experiment. |
def build_scale_free_control_network(set_of_nodes, G, community_bonus, logger, epoch, all_buyers_in_market):
¶
Constructs a control network for a scale-free network simulation.
| Parameters | |
| set | random subset of buyers |
| G | graph representing initial market state |
| community | bonus to purchase probability from being in the same community |
| logger | logging object |
| epoch | current epoch (for logger) |
| all | list of all buyers in market |
| Returns | |
| graph representing initial market state in scale free structure | |
def initialize_scale_free_control(number_of_buyers, minimum_number_of_communities, minimum_community_fill, assemblage, initial_set_size, community_bonus, logger):
¶
| Parameters | |
| number | number of buyers in marketspace |
| minimum | minimum number of communities to which buyers belong |
| minimum | minimum number of buyers per community |
| assemblage | list of items for sale in marketspace |
| initial | number of buyers in market at initialization |
| community | degree to which community affiliation impacts purchase intention |
| logger | logging object |
| Returns | |
| Graph, new set of buyers currently in the market | |
Construct a random graph.
| Parameters | |
| group | a CommunitySet object |
| probability | probability that any two nodes (buyers) have an edge |
| Returns | |
| graph representing randomized market state | |
def make_sf_control_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 control experiment.
| Parameters | |
| num | number of buyers in marketspace |
| min | minimum number of communities to which buyers belong |
| min | minimum number of buyers per community |
| assemblage | list of items for sale in marketspace |
| epochs | number of epochs (purchase cycles) |
| upper | % of buyers that must own a particular item to change a buyer's intention to that item |
| lower | max % of buyers that may own a particular item to change a buyer's intention to random item |
| death | percentage at which an item is removed from the market |
| results | path to directory to store results files |
| community | degree to which community affiliation impacts purchase intention |
| initial | number of buyers in market at initialization |
| set | number of buyers added to market after initialization |