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 elementsjoin_irreducible_color (
str, default:'#8ae234') β The color for join irreducible elementsmeet_semi_lattice (
bool, default:False) β Whether to display in meet semi-lattice contextjoin_semi_lattice (
bool, default:False) β Whether to display in join semi-lattice contextmeet_irreducible (
bool, default:False) β Whether to display as meet irreduciblejoin_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 renderindex (
int|None, default:None) β The index of the elementcurrent (
bool, default:False) β Whether element is the current elementsuccessors (
Collection[PrimeFactors] |None, default:None) β The successors of the elementpredecessors (
Collection[PrimeFactors] |None, default:None) β The predecessors of the element
- Returns:
A dictionary of Graphviz attributes
- Return type:
- property join_irreducible: bool#
Get or set the join irreducible mode.
- Returns:
True if displayed in join irreducible mode
- Return type:
- property join_irreducible_color: str#
Get or set the join irreducible color.
- Returns:
The join irreducible color
- Return type:
- property join_semi_lattice: bool#
Get or set the join semi-lattice mode.
- Returns:
True if displayed in join semi-lattice mode
- Return type:
- property meet_irreducible: bool#
Get or set the meet irreducible mode.
- Returns:
True if displayed in meet irreducible mode
- Return type:
- property meet_irreducible_color: str#
Get or set the meet irreducible color.
- Returns:
The meet irreducible color
- Return type:
- property meet_semi_lattice: bool#
Get or set the meet semi-lattice mode.
- Returns:
True if displayed in meet semi-lattice mode
- Return type:
- render(element, index)#
Render a prime factor for a cell element.
- Parameters:
element (
PrimeFactors) β The prime factors to renderindex (
int) β The index of the element
- Returns:
The Markdown representation of the prime factors
- Return type: