GOOD.utils.graph_visualize

Matplotlib utils for graph plots.

Functions

plot_calculation_graph(calculation_graph[, ...])

Processing of graphs before plot

plot_graph(nx_Gs[, color_attr, colors, ...])

Plot a graph with Matplotlib

GOOD.utils.graph_visualize.plot_calculation_graph(calculation_graph, graph_idx=0, color_attr=None, k_hop=None, **kwargs)[source]

Processing of graphs before plot

Parameters
  • calculation_graph (Batch) – graph data to be processed

  • graph_idx (int, list, tuple or torch.Tensor) – the central node(s)

  • color_attr (str or None) – color attribute of nodes

  • k_hop (int) – number of hops in graph to plot

  • **kwargs – key word arguments for the use of plot_graph()

Returns

None

GOOD.utils.graph_visualize.plot_graph(nx_Gs, color_attr=None, colors=None, font_color='white', font_size=12, node_size=300, arrows=True, vmin=None, vmax=None, pos=None, line_width=1.0, enable_label=True, label_attr=None, enable_colorbar=True, save_fig_path=None)[source]

Plot a graph with Matplotlib

Parameters
  • nx_Gs (Graph) – input graph (networkx.Graph)

  • color_attr (str or None) – color attribute of nodes

  • colors (str or list or None) – Node color

  • font_color (str) – font color in plot

  • node_size (int) – Size of nodes.

  • arrows (bool or None) – arrowheads style for drawing. If None, directed graphs draw arrowheads with FancyArrowPatch, while undirected graphs draw edges via LineCollection for speed. If True, draw arrowheads with FancyArrowPatches (bendable and stylish). If False, draw edges using LineCollection (linear and fast).

  • vmin (float or None) – minimum for node colormap scaling

  • vmax (float or None) – maximum for node colormap scaling

  • pos (list or None) – positions values of nodes

  • line_width (float) – line width in plot

  • enable_label (bool) – whether to add labels in plot

  • enable_colorbar (bool) – whether to use colorbar in plot

  • save_fig_path (str or None) – path to save plot file

Returns

None