paroto.viz.problem_graph ======================== .. py:module:: paroto.viz.problem_graph .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: paroto.viz.problem_graph.DEFAULT_CONSTRAINT_MARKERS paroto.viz.problem_graph.UNCONNECTED_LEVEL paroto.viz.problem_graph.PRIMARY_LEVEL Classes ------- .. autoapisummary:: paroto.viz.problem_graph.ProblemGraph Module Contents --------------- .. py:data:: DEFAULT_CONSTRAINT_MARKERS :value: ['margin', 'constraint', 'satisfied', 'error'] .. py:data:: UNCONNECTED_LEVEL :value: -1 .. py:data:: PRIMARY_LEVEL :value: 0 .. py:class:: 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. :param prob: OpenMDAO problem (must have setup() called) :type prob: :py:class:`openmdao.api.Problem` :param primary_params: List of primary parameter names (design variables). Can be partial names that will be matched :type primary_params: :py:class:`list` of :py:class:`str`, *optional* :param constraint_markers: Keywords to identify constraint variables (e.g., ['margin', 'constraint']) :type constraint_markers: :py:class:`list` of :py:class:`str`, *optional* .. attribute:: nodes Mapping of node_id -> node attributes (type, level, units, value, label, subsystem) :type: :py:class:`dict` .. attribute:: edges List of (source, target) connections :type: :py:class:`list` of :py:class:`tuple` .. attribute:: primary_params Full names of primary parameters :type: :py:class:`list` .. py:attribute:: prob .. py:attribute:: model .. py:attribute:: nodes :type: Dict[str, Dict[str, Any]] .. py:attribute:: edges :type: List[Tuple[str, str]] :value: [] .. py:attribute:: primary_params :type: List[str] :value: [] .. py:method:: get_nodes_by_level(max_level = None) Get nodes organized by hierarchy level. :param max_level: Maximum level to include. If None, includes all levels :type max_level: :py:class:`int`, *optional* :returns: Mapping of level -> list of node_ids :rtype: :py:class:`dict` .. py:method:: get_nodes_by_subsystem() Get nodes organized by subsystem. :returns: Mapping of subsystem_name -> list of node_ids :rtype: :py:class:`dict` .. py:method:: get_nodes_by_type() Get nodes organized by type. :returns: Mapping of node_type -> list of node_ids :rtype: :py:class:`dict` .. py:method:: filter_by_level(max_level) Get filtered view with nodes up to max_level. :param max_level: Maximum hierarchy level to include :type max_level: :py:class:`int` :returns: (filtered_nodes, filtered_edges) dictionaries :rtype: :py:class:`tuple` .. py:method:: get_statistics() Get graph statistics. :returns: Statistics including node counts, edge counts, level distribution :rtype: :py:class:`dict`