boofun.visualization.growth_plots

Growth and asymptotic visualization for Boolean function families.

This module provides specialized plotting tools for: - Asymptotic behavior as n grows - Family comparison plots - Theoretical vs computed overlays - Phase transition visualization

Functions

quick_growth_plot(family_name[, properties, ...])

Quick way to visualize asymptotic behavior of a built-in family.

Classes

ComplexityVisualizer([backend])

Visualize query complexity measures and their relationships.

GrowthVisualizer([backend])

Specialized visualizer for asymptotic behavior of Boolean function families.

LTFVisualizer([backend])

Specialized visualizations for Linear Threshold Functions.

class boofun.visualization.growth_plots.GrowthVisualizer(backend: str = 'matplotlib')[source]

Specialized visualizer for asymptotic behavior of Boolean function families.

Features: - Plot properties vs n with theoretical overlays - Compare multiple families - Visualize convergence rates - Show phase transitions

__init__(backend: str = 'matplotlib')[source]

Initialize growth visualizer.

Parameters:

backend – “matplotlib” or “plotly”

plot_growth(tracker: GrowthTracker, marker_name: str, show_theory: bool = True, show_error: bool = True, log_x: bool = False, log_y: bool = False, figsize: Tuple[int, int] = (10, 6), title: str | None = None, ax=None, **kwargs)[source]

Plot a single tracked property vs n.

Parameters:
  • tracker – GrowthTracker with computed results

  • marker_name – Which marker to plot

  • show_theory – Show theoretical prediction

  • show_error – Show error bars/ribbon (if available)

  • log_x – Use log scale

  • log_y – Use log scale

  • figsize – Figure size

  • title – Custom title

  • ax – Matplotlib axes (optional)

Returns:

Figure/axes

plot_family_comparison(trackers: Dict[str, GrowthTracker], marker_name: str, show_theory: bool = True, log_x: bool = False, log_y: bool = False, figsize: Tuple[int, int] = (12, 6), title: str | None = None)[source]

Compare a property across multiple function families.

Parameters:
  • trackers – Dict mapping family names to GrowthTrackers

  • marker_name – Property to compare

  • show_theory – Show theoretical predictions

  • log_x – Use log scale

  • log_y – Use log scale

  • figsize – Figure size

  • title – Custom title

Returns:

Figure

plot_convergence_rate(tracker: GrowthTracker, marker_name: str, reference: str = 'sqrt_n', figsize: Tuple[int, int] = (10, 6))[source]

Plot ratio of computed value to theoretical reference.

Useful for seeing convergence rates and constant factors.

Parameters:
  • tracker – GrowthTracker with results

  • marker_name – Property to analyze

  • reference – Reference function (“sqrt_n”, “n”, “log_n”, “constant”)

  • figsize – Figure size

Returns:

Figure

plot_multi_property_growth(tracker: GrowthTracker, marker_names: List[str] | None = None, figsize: Tuple[int, int] = (14, 4))[source]

Plot multiple properties side by side.

Parameters:
  • tracker – GrowthTracker with results

  • marker_names – Which markers to plot (None = all)

  • figsize – Figure size (per subplot)

Returns:

Figure

class boofun.visualization.growth_plots.LTFVisualizer(backend: str = 'matplotlib')[source]

Specialized visualizations for Linear Threshold Functions.

__init__(backend: str = 'matplotlib')[source]
plot_weight_distribution(weights: ndarray, figsize: Tuple[int, int] = (10, 6), title: str | None = None)[source]

Plot weight distribution of an LTF.

Parameters:
  • weights – LTF weight vector

  • figsize – Figure size

  • title – Custom title

Returns:

Figure

plot_influence_vs_weight(f: BooleanFunction, figsize: Tuple[int, int] = (8, 8))[source]

Scatter plot comparing |weight| vs influence.

Parameters:
  • f – Boolean function (should be LTF)

  • figsize – Figure size

Returns:

Figure

class boofun.visualization.growth_plots.ComplexityVisualizer(backend: str = 'matplotlib')[source]

Visualize query complexity measures and their relationships.

__init__(backend: str = 'matplotlib')[source]
plot_complexity_relations(f: BooleanFunction, figsize: Tuple[int, int] = (12, 5))[source]

Plot relationships between different complexity measures.

Shows s(f), bs(f), deg(f), C(f) and their bounds.

Parameters:
  • f – Boolean function

  • figsize – Figure size

Returns:

Figure

boofun.visualization.growth_plots.quick_growth_plot(family_name: str, properties: List[str] = ['total_influence', 'noise_stability'], n_values: List[int] | None = None, **kwargs)[source]

Quick way to visualize asymptotic behavior of a built-in family.

Parameters:
  • family_name – “majority”, “parity”, “tribes”, “and”, “or”, “dictator”

  • properties – Which properties to track

  • n_values – List of n values (default: odd 3-15)

Returns:

Figure