genplanner.ZoneRelationMatrix¶
- class genplanner.ZoneRelationMatrix(zones, _m)[source]¶
Symmetric matrix of relations between zones. Access is O(1). Default relation is NEUTRAL.
- Symmetry invariant:
_m[a][b] == _m[b][a] for all a,b
- __init__(zones, _m)¶
Methods
__init__(zones, _m)as_dataframe()Returns a DataFrame with Zone objects as both index and columns.
empty(zones[, default])from_dataframe(df, *[, value_map, default, ...])df must be square.
from_kind_forbidden(zones, kind_forbidden, *)from_pairs(zones, *[, neighbors, forbidden, ...])Build from explicit pairs.
get(a, b)is_forbidden(a, b)is_neighbor(a, b)subset(zones, *[, strict])Return a new matrix restricted to the provided zones (if present in this matrix).
to_pretty_string(*[, name_width, ...])with_pairs(pairs, rel)Applies pairs and enforces symmetry: (a,b) and (b,a) both set to rel.
zone_forbidden()zone_neighbors()Attributes
zones