plot_graph¶
- samplomatic.visualization.plot_graph(graph: PyDiGraph[T, S], cols: int = 2, subgraph_idxs: None | int | Sequence[int] = None, layout_method: LayoutPresets | LayoutMethod[T, S] = 'auto', ranker: NodeRanker[T] | None = None) Figure[source]¶
Visualize the disconnected subgraphs of a graph.
This function identifies all disconnected subgraphs within the given
graphusing theweakly_connected_components()method. Then, it plots all of the subgraphs corresponding to the indices specified insubgraph_idxs, with each selected subgraph displayed in its own subplot.- Parameters:
graph – The graph to visualize.
cols – The number of columns in the returned figure.
subgraph_idxs – The indices of the connected subgraphs to include in the plot, or
Noneto include all of the available subgraphs.layout_method – A predefined layout method by name, or a callable implementing a layout.
ranker – Specifies a node ranking that can be used by layout methods that group nodes topologically.
- Returns:
A Plotly graph.