galactic.algebras.lattice.examples.arithmetic.renderer#

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

Classes


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

Bases: NodeRenderer[PrimeFactors, PrimeFactors], CellRenderer[PrimeFactors, 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

render_row(elem, relation, index)#

Render a prime factor for a cell element.

Parameters:
Returns:

The Markdown representation of the prime factors

Return type:

str

render_col(elem, relation, index)#

Render a prime factor for a cell element.

Parameters:
Returns:

The Markdown representation of the prime factors

Return type:

str

attributes(elem, domain, co_domain, *, index=None, current=False, successors=None, predecessors=None)#

Produce a dictionary of Graphviz attributes for a node.

Parameters:
Returns:

A dictionary of Graphviz attributes

Return type:

dict[str, str]

model_config: ClassVar[ConfigDict] = {'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].