decent_bench.utils.network_utils#
- decent_bench.utils.network_utils.plot_network(network: decent_bench.networks.Network, *, ax: Axes | None = None, layout: Literal['spring', 'kamada_kawai', 'circular', 'random', 'shell'] = 'spring', **draw_kwargs: Mapping[str, object]) Axes[source]#
Plot a Network using NetworkX drawing utilities.
- Parameters:
network – Network to be plotted.
ax – optional
matplotlib.axes.Axesto draw on. IfNonea new figure is created.layout – layout algorithm to position nodes (e.g.
networkx.drawing.layout.spring_layout(),networkx.drawing.layout.kamada_kawai_layout(),networkx.drawing.layout.circular_layout(),networkx.drawing.layout.random_layout(),networkx.drawing.layout.shell_layout()).draw_kwargs – forwarded to
networkx.drawing.nx_pylab.draw_networkx().
- Returns:
The matplotlib
matplotlib.axes.Axescontaining the plot.- Raises:
RuntimeError – if matplotlib is not available.
ValueError – if an unsupported layout is requested.