grai_graph
visualizations

output_graph

def output_graph(graph: nx.DiGraph,
                 file_name: Union[Path, str],
                 sort: bool = True,
                 file_format=None,
                 dpi: Optional[int] = 800) -> None

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

Arguments:

  • graph nx.DiGraph - the DiGraph to write or plot
  • file_name Union[Path, str] - the file name to write to.
  • sort bool, optional - create a copy of the graph with sorted keys (Default value = True)
  • file_format - graphviz output format, if None, the file_name extension is used as format https://graphviz.org/doc/info/output.html (opens in a new tab) (Default value = None)
  • dpi Optional[int], optional - (Default value = 800)

Returns:

Raises:

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

plot_graph

def plot_graph(graph: nx.DiGraph,
               dpi: int = 800,
               figsize: Optional[Tuple[int, int]] = None)

Arguments:

  • graph nx.DiGraph - the DiGraph to write or plot
  • dpi int, optional - dpi of the matplotlib figure. (Default value = 800)
  • figsize Optional[Tuple[int, int]], optional - (Default value = None)

Returns:

: Displays the image