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 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
- render_row(elem, relation, index)#
Render a prime factor for a cell element.
- Parameters:
elem (
PrimeFactors) β The prime factors to renderrelation (
BinaryRelation[PrimeFactors,PrimeFactors]) β The relationindex (
int) β The index of the element
- Returns:
The Markdown representation of the prime factors
- Return type:
- render_col(elem, relation, index)#
Render a prime factor for a cell element.
- Parameters:
elem (
PrimeFactors) β The prime factors to renderrelation (
BinaryRelation[PrimeFactors,PrimeFactors]) β The relationindex (
int) β The index of the element
- Returns:
The Markdown representation of the prime factors
- Return type:
- attributes(elem, domain, co_domain, *, index=None, current=False, successors=None, predecessors=None)#
Produce a dictionary of Graphviz attributes for a node.
- Parameters:
elem (
PrimeFactors) β The prime factors to renderindex (
int|None, default:None) β The index of the elementcurrent (
bool, default:False) β Whether elem is the current elementdomain (
Collection[PrimeFactors]) β The domain of the relationco_domain (
Collection[PrimeFactors]) β The co-domain of the relationsuccessors (
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: