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

>>> vertices = [1, 2, 3, 4]
>>> edges = [(1, 2), (2, 3), (2, 4), (1, 4)]
>>> print(draw(vertices, edges))
+---+     +---+
| 3 |     | 4 |
+---+    *+---+
  *    **   *
  *  **     *
  * *       *
+---+       *
| 2 |      *
+---+     *
     *    *
      *  *
       **
     +---+
     | 1 |
     +---+