LayoutSquasher#
- class wattson.analysis.visualization.layout.layout_squasher.LayoutSquasher#
Bases:
objectMethods
Compresses a geo-layout while:
squash_layout_deterministicRadially compresses a geo-layout toward the primary facility while:
Radially squash a layout toward the fixpoint.
- static squash_layout(neighbors: dict[str, list[str]], rectangles: dict[str, ViewBox], primary_facility: str, aggressiveness_factor: float = 0.5, min_spacing_factor: float = 0.4, iterations: int = 300, geo_weight: float = 0.03, edge_weight: float = 0.15, compression_weight: float = 0.35, damping: float = 0.82, step_size: float = 1.0) dict[str, tuple[float, float]]#
- Compresses a geo-layout while:
preserving overall geographic feel
avoiding overlaps
respecting neighbor connectivity
keeping primary facility fixed
- Returns:
dict[facility_id] -> (dx, dy)
- static squash_layout_radial(neighbors: Dict[str, List[str]], rectangles: Dict[str, ViewBox], primary_facility: str, aggressiveness_factor: float = 0.5, min_spacing_factor: float = 0.15, max_iterations: int = 200, radial_push_step: float = 4.0, outer_boost: float = 1.0) Dict[str, Tuple[float, float]]#
- Radially compresses a geo-layout toward the primary facility while:
preserving directional/geographic structure
preventing overlaps
preserving graph readability
keeping the primary facility fixed
Movement is constrained to the original radial direction from the primary facility.
- Returns:
- dict[facility_id] -> (dx, dy)
Offset relative to original position.
- static squash_layout_radial_non_linear(neighbors: dict[str, List[str]], rectangles: dict[str, ViewBox], fixpoint: str, aggressiveness_factor: float = 0.9, inner_deadzone: float = 0.05, outer_boost: float = 2.4) dict[str, tuple[float, float]]#
Radially squash a layout toward the fixpoint.
- Parameters:
rectangles – node_id -> (x, y, width, height)
neighbors – Included for signature compatibility.
fixpoint – Node acting as radial anchor.
aggressiveness_factor – Overall squash strength in [0, 1].
inner_deadzone – Fraction of max radius where movement is strongly damped.
outer_boost – Nonlinear exponent controlling how aggressively outer regions are compressed.
- Returns:
Offsets to apply to original rectangle positions.
- Return type:
dict[node_id, (dx, dy)]