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-corerunnablesgraph_pngPngDrawer
    Class●Since v0.1

    PngDrawer

    Copy
    PngDrawer(
      self,
      fontname: str | None = None,
      labels: LabelsDict | None = 

    Constructors

    Attributes

    Methods

    View source on GitHub
    None
    )

    Parameters

    NameTypeDescription
    fontnamestr | None
    Default:None
    labelsLabelsDict | None
    Default:None
    constructor
    __init__
    NameType
    fontnamestr | None
    labelsLabelsDict | None
    attribute
    fontname
    attribute
    labels
    method
    get_node_label
    method
    get_edge_label
    method
    add_node
    method
    add_edge
    method
    draw
    method
    add_nodes
    method
    add_subgraph
    method
    add_edges
    method
    update_styles

    Helper class to draw a state graph into a PNG file.

    It requires graphviz and pygraphviz to be installed.

    Example:

    drawer = PngDrawer()
    drawer.draw(state_graph, "graph.png")

    The font to use for the labels. Defaults to "arial".

    A dictionary of label overrides. The dictionary should have the following format: { "nodes": { "node1": "CustomLabel1", "node2": "CustomLabel2", "end": "End Node" }, "edges": { "continue": "ContinueLabel", "end": "EndLabel" } } The keys are the original labels, and the values are the new labels.

    Returns the label to use for a node.

    Returns the label to use for an edge.

    Adds a node to the graph.

    Adds an edge to the graph.

    Draw the given state graph into a PNG file.

    Requires graphviz and pygraphviz to be installed.

    Add nodes to the graph.

    Add subgraphs to the graph.

    Add edges to the graph.

    Update the styles of the entrypoint and END nodes.