galactic.algebras.poset.renderer#

Defines classes for visualizing Hasse diagrams of partially ordered sets (posets).

Classes


class HasseDiagram(poset, drawer)#

Bases: Generic[_P]

It is used for drawing Hasse diagrams.

Parameters:
property poset: PartiallyOrderedSet[_P]#

Get the partially ordered set.

Returns:

The partially ordered set.

Return type:

PartiallyOrderedSet[_P]

property digraph: Digraph#

Get the graphviz digraph for this partially ordered set.

Returns:

The graphviz digraph for this partially ordered set.

Return type:

Digraph

render(path)#

Render the diagram in a file.

Parameters:

path (Path) – A file path.

Return type:

None

pipe(output='svg')#

Pipe the diagram.

Parameters:

output (str, default: 'svg') – The format used

Returns:

The image of the diagram.

Return type:

bytes

class HasseDiagramRenderer(**data)#

Bases: GraphRenderer[TypeVar, TypeVar]

It renders graph attributes.

graph_attributes()#

Return a dictionary of graphviz attributes for a Hasse diagram.

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].

class HasseDiagramDrawer(**data)#

Bases: Resource, Generic[_P]

It is used for drawing Hasse diagrams.

Parameters:
export(poset, path)#

Export the poset in a file.

Parameters:
Return type:

None

draw(poset)#

Draw the diagram.

Parameters:

poset (PartiallyOrderedSet[TypeVar(_P, bound= PartiallyComparable)]) – The poset to draw

Returns:

The diagram.

Return type:

HasseDiagram[TypeVar(_P, bound= PartiallyComparable)]

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

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