generate_lists
- snafu.generate_lists.gen_lists(g, td, seed=None)[source]
Generate simulated lists by running censored random walks on a graph.
This function simulates category fluency-style data by performing repeated random walks on a given graph g, using parameters defined in td. It returns the visited item lists, unused step info (placeholder), and a flag indicating whether the output used all nodes in the graph.
- Parameters:
g (networkx.Graph) – The graph on which the random walks are performed.
td (DataModel) – Object containing simulation parameters such as list length, jump probability, priming, and censoring behavior.
seed (int, optional) – Random seed for reproducibility. Default is None.
- Returns:
list of list – Simulated fluency data (visited node sequences) for each run.
list – Placeholder for step counts between items (currently unused).
int – A binary flag indicating if not all nodes were visited (1 = graph altered).
- snafu.generate_lists.random_walk(g, td, priming_vector=[], seed=None)[source]
Perform a censored random walk on a graph, optionally with priming and jumping.
This function simulates a walk on graph g, incorporating jump probabilities, censoring behavior, and optional priming effects to simulate memory recall or fluency search strategies.
- Parameters:
g (networkx.Graph) – Graph on which the random walk is performed.
td (DataModel) – Object defining walk behavior: jump probability, jump type, max steps, starting node policy, censoring, and priming.
priming_vector (list, optional) – List of previously visited nodes to bias the walk. Default is empty.
seed (int, optional) – Random seed for reproducibility. Default is None.
- Returns:
A list of (from_node, to_node) edges representing the random walk path.
- Return type:
list of tuple