mufasa.graph_svg.draw#

Draws a graph description as SVG. Styles (graph.css), hover script (graph.js) and icons (icons/) are files next to this module.

Attributes#

Classes#

FusionGraphSVG

A rendered Fusion Graph. Displays itself in Jupyter notebooks; save() writes an .svg file.

Functions#

asset(name) → str

short_code(name) → str

A 2-3 letter code for a class name: BayesianFusion -> BF, POM -> POM, Threshold -> TH.

render(spec[, prefix, embed_assets]) → str

Draw a graph description as an SVG string.

Module Contents#

mufasa.graph_svg.draw.R = 34#
mufasa.graph_svg.draw.PORT_R = 13#
mufasa.graph_svg.draw.ASSETS#
mufasa.graph_svg.draw.asset(name: str) → str#
Parameters:

name (str)

Return type:

str

mufasa.graph_svg.draw.short_code(name: str) → str#

A 2-3 letter code for a class name: BayesianFusion -> BF, POM -> POM, Threshold -> TH.

Parameters:

name (str)

Return type:

str

mufasa.graph_svg.draw.render(spec: mufasa.graph_svg.spec.GraphSpec, prefix: str | None = None, embed_assets: bool = True) → str#

Draw a graph description as an SVG string.

prefix makes ids unique when several graphs share a page. With embed_assets the SVG carries its own styles and hover script (e.g. for notebooks); without, the page must load graph.css and graph.js.

Parameters:
Return type:

str

class mufasa.graph_svg.draw.FusionGraphSVG(svg: str)#

A rendered Fusion Graph. Displays itself in Jupyter notebooks; save() writes an .svg file.

Parameters:

svg (str)

svg#
__str__() → str#
Return type:

str

save(path) → None#
Return type:

None