Colab 中未显示 Graphviz 输出

Graphvis output is not shown in Colab

Colab 未显示 Graphviz 图的输出(例如 https://graphviz.readthedocs.io/en/stable/examples.html)。我怎样才能在 Colab 中简单地实现它?我什至尝试绘制它生成的 PDF 文件,但这并不简单。

您不需要致电 g.view()。只用 g 结束代码就足够了,像这样:

g = Digraph('G')
g.edge('Hello', 'World')
g

这是一个最小的例子notebook