galactic.algebras.lattice.examples.arithmetic.viewer#

Defines the viewer for prime factorization in a lattice algebra context.

Classes


class PrimeFactorsRenderer(meet_irreducible_color='#fcaf3e', join_irreducible_color='#8ae234', meet_semi_lattice=False, join_semi_lattice=False, meet_irreducible=False, join_irreducible=False)#

Bases: NodeRenderer[PrimeFactors, PrimeFactors], CellRenderer[PrimeFactors]

Render prime factors for various diagram contexts.

This renderer provides:

  • Graphviz node attributes for Hasse diagrams.

  • Header and row titles for reduced contexts.

Parameters:
  • meet_irreducible_color (str, default: '#fcaf3e') – The color for meet irreducible elements

  • join_irreducible_color (str, default: '#8ae234') – The color for join irreducible elements

  • meet_semi_lattice (bool, default: False) – Whether to display in meet semi-lattice context

  • join_semi_lattice (bool, default: False) – Whether to display in join semi-lattice context

  • meet_irreducible (bool, default: False) – Whether to display as meet irreducible

  • join_irreducible (bool, default: False) – Whether to display as join irreducible

attributes(element, index=None, current=False, successors=None, predecessors=None)#

Produce a dictionary of Graphviz attributes for a node.

Parameters:
  • element (PrimeFactors) – The prime factors to render

  • index (int | None, default: None) – The index of the element

  • current (bool, default: False) – Whether element is the current element

  • successors (Collection[PrimeFactors] | None, default: None) – The successors of the element

  • predecessors (Collection[PrimeFactors] | None, default: None) – The predecessors of the element

Returns:

A dictionary of Graphviz attributes

Return type:

dict[str, str]

property join_irreducible: bool#

Get or set the join irreducible mode.

Returns:

True if displayed in join irreducible mode

Return type:

bool

property join_irreducible_color: str#

Get or set the join irreducible color.

Returns:

The join irreducible color

Return type:

str

property join_semi_lattice: bool#

Get or set the join semi-lattice mode.

Returns:

True if displayed in join semi-lattice mode

Return type:

bool

property meet_irreducible: bool#

Get or set the meet irreducible mode.

Returns:

True if displayed in meet irreducible mode

Return type:

bool

property meet_irreducible_color: str#

Get or set the meet irreducible color.

Returns:

The meet irreducible color

Return type:

str

property meet_semi_lattice: bool#

Get or set the meet semi-lattice mode.

Returns:

True if displayed in meet semi-lattice mode

Return type:

bool

render(element, index)#

Render a prime factor for a cell element.

Parameters:
  • element (PrimeFactors) – The prime factors to render

  • index (int) – The index of the element

Returns:

The Markdown representation of the prime factors

Return type:

str