draw_ascii#
- langchain_core.runnables.graph_ascii.draw_ascii(vertices: Mapping[str, str], edges: Sequence[Edge]) str [source]#
Build a DAG and draw it in ASCII.
- Parameters:
vertices (list) – list of graph vertices.
edges (list) – list of graph edges.
- Returns:
ASCII representation
- Return type:
str
Example
from langchain_core.runnables.graph_ascii import draw_ascii vertices = {1: "1", 2: "2", 3: "3", 4: "4"} edges = [ (source, target, None, None) for source, target in [(1, 2), (2, 3), (2, 4), (1, 4)] ] print(draw_ascii(vertices, edges))
+---+ | 1 | +---+ * * * * * * +---+ * | 2 | * +---+** * * ** * * ** * * ** +---+ +---+ | 3 | | 4 | +---+ +---+