Home / Function/ add_edge() — langchain Function Reference

add_edge() — langchain Function Reference

Architecture documentation for the add_edge() function in graph_png.py from the langchain codebase.

Function python LangChainCore Runnables calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  d2ef13c6_e82b_33d6_fa5a_b78fd99c12a6["add_edge()"]
  5a670bac_6993_ecfd_ad71_f79187c3df76["PngDrawer"]
  d2ef13c6_e82b_33d6_fa5a_b78fd99c12a6 -->|defined in| 5a670bac_6993_ecfd_ad71_f79187c3df76
  18b74f26_5e8d_d54f_32a6_6c80561653ab["add_edges()"]
  18b74f26_5e8d_d54f_32a6_6c80561653ab -->|calls| d2ef13c6_e82b_33d6_fa5a_b78fd99c12a6
  8c2c01bc_891d_1695_eb18_f22076f6deb7["get_edge_label()"]
  d2ef13c6_e82b_33d6_fa5a_b78fd99c12a6 -->|calls| 8c2c01bc_891d_1695_eb18_f22076f6deb7
  style d2ef13c6_e82b_33d6_fa5a_b78fd99c12a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/graph_png.py lines 94–118

    def add_edge(
        self,
        viz: Any,
        source: str,
        target: str,
        label: str | None = None,
        conditional: bool = False,  # noqa: FBT001,FBT002
    ) -> None:
        """Adds an edge to the graph.

        Args:
            viz: The graphviz object.
            source: The source node.
            target: The target node.
            label: The label for the edge.
            conditional: Whether the edge is conditional.
        """
        viz.add_edge(
            source,
            target,
            label=self.get_edge_label(label) if label else "",
            fontsize=12,
            fontname=self.fontname,
            style="dotted" if conditional else "solid",
        )

Domain

Subdomains

Called By

Frequently Asked Questions

What does add_edge() do?
add_edge() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/graph_png.py.
Where is add_edge() defined?
add_edge() is defined in libs/core/langchain_core/runnables/graph_png.py at line 94.
What does add_edge() call?
add_edge() calls 1 function(s): get_edge_label.
What calls add_edge()?
add_edge() is called by 1 function(s): add_edges.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free