visions.utils.graph

visions.utils.graph.output_graph(G, file_name, sort=True, file_format=None)[source]

Output a graph to a file, either as image or as dot file.

Parameters
  • G (DiGraph) – the DiGraph to write or plot

  • file_name (Union[Path, str]) – the file name to write to.

  • sort (bool) – create a copy of the graph with sorted keys

  • file_format – graphviz output format, if None, the file_name extension is used as format https://graphviz.org/doc/info/output.html

Return type

None

Returns

Nothing

Raises

ValueError when the file_name does not end on .svg, png or dot