paroto.viz.problem_graph#

Problem graph abstraction for OpenMDAO visualization.

This module provides a unified graph representation that can be consumed by different visualization backends (Mermaid, Cytoscape, NetworkX, etc.). Uses OpenMDAO’s connection model as the foundation.

Attributes#

Classes#

ProblemGraph

Unified graph abstraction for OpenMDAO Problem visualization.

Module Contents#

paroto.viz.problem_graph.DEFAULT_CONSTRAINT_MARKERS = ['margin', 'constraint', 'satisfied', 'error']#
paroto.viz.problem_graph.UNCONNECTED_LEVEL = -1#
paroto.viz.problem_graph.PRIMARY_LEVEL = 0#
class paroto.viz.problem_graph.ProblemGraph(prob, primary_params=None, constraint_markers=None)#

Unified graph abstraction for OpenMDAO Problem visualization.

This class wraps an OpenMDAO Problem and provides a clean, unified interface for extracting graph structure that can be consumed by any visualization backend.

Parameters:
  • prob (openmdao.api.Problem) – OpenMDAO problem (must have setup() called)

  • primary_params (list of str, optional) – List of primary parameter names (design variables). Can be partial names that will be matched

  • constraint_markers (list of str, optional) – Keywords to identify constraint variables (e.g., [‘margin’, ‘constraint’])

nodes#

Mapping of node_id -> node attributes (type, level, units, value, label, subsystem)

Type:

dict

edges#

List of (source, target) connections

Type:

list of tuple

primary_params#

Full names of primary parameters

Type:

list

prob#
model#
nodes: Dict[str, Dict[str, Any]]#
edges: List[Tuple[str, str]] = []#
primary_params: List[str] = []#
get_nodes_by_level(max_level=None)#

Get nodes organized by hierarchy level.

Parameters:

max_level (int, optional) – Maximum level to include. If None, includes all levels

Returns:

Mapping of level -> list of node_ids

Return type:

dict

get_nodes_by_subsystem()#

Get nodes organized by subsystem.

Returns:

Mapping of subsystem_name -> list of node_ids

Return type:

dict

get_nodes_by_type()#

Get nodes organized by type.

Returns:

Mapping of node_type -> list of node_ids

Return type:

dict

filter_by_level(max_level)#

Get filtered view with nodes up to max_level.

Parameters:

max_level (int) – Maximum hierarchy level to include

Returns:

(filtered_nodes, filtered_edges) dictionaries

Return type:

tuple

get_statistics()#

Get graph statistics.

Returns:

Statistics including node counts, edge counts, level distribution

Return type:

dict