MCPcopy Create free account
hub / github.com/dask/dask / visualize

Method visualize

dask/highlevelgraph.py:654–696  ·  view source on GitHub ↗

Visualize this dask high level graph. Requires ``graphviz`` to be installed. Parameters ---------- filename : str or None, optional The name of the file to write to disk. If the provided `filename` doesn't include an extension, '.png

(self, filename="dask-hlg.svg", format=None, **kwargs)

Source from the content-addressed store, hash-verified

652 return cls(layers, dependencies)
653
654 def visualize(self, filename="dask-hlg.svg", format=None, **kwargs):
655 """
656 Visualize this dask high level graph.
657
658 Requires ``graphviz`` to be installed.
659
660 Parameters
661 ----------
662 filename : str or None, optional
663 The name of the file to write to disk. If the provided `filename`
664 doesn't include an extension, '.png' will be used by default.
665 If `filename` is None, no file will be written, and the graph is
666 rendered in the Jupyter notebook only.
667 format : {'png', 'pdf', 'dot', 'svg', 'jpeg', 'jpg'}, optional
668 Format in which to write output file. Default is 'svg'.
669 color : {None, 'layer_type'}, optional (default: None)
670 Options to color nodes.
671 - None, no colors.
672 - layer_type, color nodes based on the layer type.
673 **kwargs
674 Additional keyword arguments to forward to ``to_graphviz``.
675
676 Examples
677 --------
678 >>> x.dask.visualize(filename='dask.svg') # doctest: +SKIP
679 >>> x.dask.visualize(filename='dask.svg', color='layer_type') # doctest: +SKIP
680
681 Returns
682 -------
683 result : IPython.display.Image, IPython.display.SVG, or None
684 See dask.dot.dot_graph for more information.
685
686 See Also
687 --------
688 dask.dot.dot_graph
689 dask.base.visualize # low level variant
690 """
691
692 from dask.dot import graphviz_to_file
693
694 g = to_graphviz(self, **kwargs)
695 graphviz_to_file(g, filename, format)
696 return g
697
698 def _toposort_layers(self) -> list[str]:
699 """Sort the layers in a high level graph topologically

Callers

nothing calls this directly

Calls 2

graphviz_to_fileFunction · 0.90
to_graphvizFunction · 0.70

Tested by

no test coverage detected