Neighborhoods
Neighborhood
Bases: AbstractNeighborhood
A specific Neighborhood. An instance of this classes corresponds to a particular SimulationState. It stores a map of each site_id in the SimulationState to the IDs of the sites which are it's neighbors.
Source code in pylattica/core/neighborhoods.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
__init__(graph)
Instantiates a NeighborhoodGraph.
Source code in pylattica/core/neighborhoods.py
21 22 23 |
|
neighbors_of(site_id, include_weights=False)
Retrieves a list of the IDs of the sites which are neighbors of the provided site. Optionally includes the weights of the connections to those neighbors.
Parameters
int
The site for which neighbors should be retrieved
bool, optional
Whether or not weights if the neighbor connections should be included, by default False
Returns
list[int] Either a list of site IDs, or a list of tuples of (site ID, connection weight)
Source code in pylattica/core/neighborhoods.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
SiteClassNeighborhood
Bases: MultiNeighborhood
A Neighborhood that distinguished neighbors of sites based on their class
Source code in pylattica/core/neighborhoods.py
75 76 77 78 79 80 81 82 83 84 85 86 |
|
StochasticNeighborhood
Bases: MultiNeighborhood
A NeighborhoodGraph for stochastic neighborhoods.
Source code in pylattica/core/neighborhoods.py
65 66 67 68 69 70 71 72 |
|