langchain_core.runnables.graph_ascii
.draw_ascii¶
- langchain_core.runnables.graph_ascii.draw_ascii(vertices: Mapping[str, str], edges: Sequence[Edge]) str [源码]¶
构建一个有向无环图(DAG)并在ASCII码中绘制它。
- 参数
vertices (列表) – 图顶点的列表。
edges (列表) – 图边的列表。
- 返回
ASCII表示形式
- 返回类型
str
示例
>>> vertices = [1, 2, 3, 4] >>> edges = [(1, 2), (2, 3), (2, 4), (1, 4)] >>> print(draw(vertices, edges)) +---+ +---+ | 3 | | 4 | +---+ *+---+ * ** * * ** * * * * +---+ * | 2 | * +---+ * * * * * ** +---+ | 1 | +---+