LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-corerunnablesgraphGraphdraw_mermaid
    Methodā—Since v0.1

    draw_mermaid

    Copy
    draw_mermaid(
      self,
      *,
      with_styles: bool = True,
      curve_style: CurveStyle = CurveStyle
    View source on GitHub
    .
    LINEAR
    ,
    node_colors
    :
    NodeStyles
    |
    None
    =
    None
    ,
    wrap_label_n_words
    :
    int
    =
    9
    ,
    frontmatter_config
    :
    dict
    [
    str
    ,
    Any
    ]
    |
    None
    =
    None
    )
    ->
    str

    Parameters

    NameTypeDescription
    with_stylesbool
    Default:True

    Whether to include styles in the syntax.

    curve_styleCurveStyle
    Default:CurveStyle.LINEAR

    The style of the edges.

    node_colorsNodeStyles | None
    Default:None
    wrap_label_n_wordsint
    Default:9
    frontmatter_configdict[str, Any] | None
    Default:None

    Draw the graph as a Mermaid syntax string.

    Returns: The Mermaid syntax string.

    The colors of the nodes.

    The number of words to wrap the node labels at.

    Mermaid frontmatter config. Can be used to customize theme and styles. Will be converted to YAML and added to the beginning of the mermaid graph.

    See more here: https://mermaid.js.org/config/configuration.html.

    Example config:

    {
        "config": {
            "theme": "neutral",
            "look": "handDrawn",
            "themeVariables": {"primaryColor": "#e2e2e2"},
        }
    }