Skip to content

to_mermaid.py

graph_to_mermaid(graph, legend=True, use_dataset_styles=True, title=None, layout=None, theme=None, look=None, io_shape='rect', node_shape='rounded', view_shape='subroutine', subgraphs=False)

Convert a pipeline to a mermaid diagram

Parameters:

Name Type Description Default
graph tuple[dict[str, list[NodeData]], dict[str | None, list[IOData]]]

tuple of node modules and io modules

required
legend bool

if True, display a legend

True
use_dataset_styles bool

if True, use a distinct color for each dataset type

True
title str | None

Title of the mermaid diagram

None
layout str | None

Layout type for the diagram (e.g., 'dagre')

None
theme str | None

Theme for the diagram (e.g., 'neo')

None
look str | None

Look and feel for the diagram (e.g., 'neo')

None
io_shape str

Shape for IO nodes in the diagram

'rect'
node_shape str

Shape for processing nodes in the diagram

'rounded'
view_shape str

Shape for view nodes in the diagram

'subroutine'
subgraphs bool

if True, group nodes and IOs by their module in subgraphs

False

Returns:

Type Description
str

the pipeline rendered as mermaid diagram syntax