This module contains methods to initialize and compute metrics for a small-world simulation.
| Function | clustering |
Returns the average clustering coefficient for specified graph. This is a shortcut method to the `average_clustering()` method from NetworkX. |
| Function | connect |
Connects communities at the start of the simulation. |
| Function | form |
Instantiate a Graph and construct a lattice containing all community members. |
| Function | form |
Instantiate a graph and add a group of communities in lattice structures. |
| Function | form |
Returns a graph of fully connected communities. |
| Function | form |
Returns a graph with all possible edges added. |
| Function | get_ |
Computes small world index (SWI). |
| Function | initialize |
Sets up a small world graph for an experiment. |
| Function | is |
Checks if a network qualifies as a small world. |
| Function | make |
Construct a lattice structure out of existing nodes. |
| Function | make |
Creates an information file (.csv) for this small world experiment. |
| Function | net |
Returns average degree of nodes in a graph. |
| Function | small |
Rewires the small world network. |
Returns the average clustering coefficient for specified graph. This is a shortcut method to the `average_clustering()` method from NetworkX.
A clustering coefficient is a measure of how much nodes cluster together in a graph.
| Parameters | |
| G | target graph for computation |
| Returns | |
| average clustering coefficient for specified graph | |
Connects communities at the start of the simulation.
| Parameters | |
| G | graph containing disconnected communities |
| Returns | |
| graph containing connected communities | |
Instantiate a Graph and construct a lattice containing all community members.
| Parameters | |
| community | community containing buyers/members |
| Returns | |
| NetworkX Graph object in lattice structure | |
Instantiate a graph and add a group of communities in lattice structures.
| Parameters | |
| community | list of communities (with members) to add (CommunitySet) |
| Returns | |
| NetworkX Graph object with communities in lattice structure | |
Returns a graph of fully connected communities.
| Parameters | |
| community | List of communities (CommunitySet) |
| Returns | |
| a graph of fully connected communities | |
Returns a graph with all possible edges added.
| Parameters | |
| community | community of buyers to fully connect |
| Returns | |
| a fully connected community of buyers | |
Computes small world index (SWI).
Let n be the number of nodes in the graph. Let k be the average degree of nodes in the graph. Let L_path be the average shortest path length of nodes in the graph.
| Parameters | |
| G | target graph for computation |
| Returns | |
| small world index of inputted graph | |
Sets up a small world graph for an experiment.
| Parameters | |
| num | number of buyers in market |
| num | number of communities in market |
| min | minimum number of buyers per community |
| assemblage | list of items for sale in market |
| community | structure to initialize communities; can be dense or lattice (default: dense) |
| Returns | |
| small world graph of communities | |
Checks if a network qualifies as a small world.
| Parameters | |
| G | potential small world network |
| small | qualifying SWI |
| Returns | |
| True if qualifies as small world, False otherwise | |
Construct a lattice structure out of existing nodes.
| Parameters | |
| G | NetworkX graph object containing nodes |
| Returns | |
| restructured NetworkX graph object | |
Creates an information file (.csv) for this small world experiment.
| Parameters | |
| num | number of buyers in market |
| min | minimum number of communities |
| min | minimum number of buyers per community |
| assemblage | list of items for sale in market |
| epochs | number of market iterations |
| 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 a pot is removed from the market |
| results | directory path in which to store the file |
| prob | probability that a node is rewired each epoch |
| start | structure in which communities are initialized (dense or lattice) |
Returns average degree of nodes in a graph.
| Parameters | |
| G | target graph for computation |
| Returns | |
| average degree of nodes in a graph | |