flexeval.helpers#

Generic utility functions.

Functions

_graph_node_label(om)

Build the display label for a single node in a metric dependency graph.

generate_hash()

Create a random 8-digit id

visualize_graph(graph[, ax, output_path])

Visualize graphs produced by MetricGraphBuilder.

flexeval.helpers.generate_hash()[source]#

Create a random 8-digit id

flexeval.helpers.visualize_graph(graph: DiGraph, ax=None, output_path: str | None = None)[source]#

Visualize graphs produced by MetricGraphBuilder.

Parameters:
  • graph (nx.DiGraph) – The graph.

  • ax (matplotlib.axes.Axes | None, optional) – An existing Axes to draw into. If None, a new figure and axes are created.

  • output_path (str | None, optional) – If not None, save the figure using matplotlib.pyplot.Figure.savefig().

Returns:

The (fig, ax) the graph was drawn into.

Return type:

tuple

Raises:

ImportError – If matplotlib is not installed.