Python library for easy graph creation.
Powered by python's magic __getattr__ and __call__,
allows its users to express relations like:
g.fran.writes.fluxonsthat will create on-the-fly the nodes fran and fluxons
as members of g and the edge writes as member of fran
pointing to fluxons.
The idea is avoiding ", ', [] as much as possible
fusing referencing with creating.
Chain relations are possible:
g.fran.writes.fluxons.in.pythonwith the expected results.
Nodes and Edges can be called as functions to store metadata inside them:
g.fran(type='human').writes(lang='python').fluxons(type='code')Useful for graphviz later use.
REMEMBER: nodes are unique; edges are not.
- As edges are not unique (by design), they should not be referenced as an attribute of its origin node; this will create a new edge with the same name.
- Creating an edge on-the-fly without creating its destination is pointless as its reference will be lost.
- Node and Edges names must be valid python variable names.
- Node and Edges names cannot be the same as List members.
- Node and Edges names cannot be
name,owner,mdordest.
Install uv.
uv run python -m unittest discover tests
uv sync --extra gvto install optional dependencygraphviz.
See solar_system.py example:
uv run python examples/solar_system.py- will create
solar_system.svg
- will create
- If you have kitty, you can see it in the terminal:
kitten icat solar_system.svg
- handle clusters
- handle styling
- handle ranks
- show interactive example