mbdlyb.io ========= .. py:module:: mbdlyb.io .. autoapi-nested-parse:: Functions for exporting MBD models to various graph formats. Supports exporting MBD networks to NetworkX graphs and yEd graph editor formats, with optional node type filtering and color customization. Functions --------- .. autoapisummary:: mbdlyb.io.export_to_nx mbdlyb.io.export_to_yed Module Contents --------------- .. py:function:: export_to_nx(net: mbdlyb.MBDNet, *node_types: Type[mbdlyb.MBDNode], relation_types: Optional[list[Type[mbdlyb.MBDRelation]]] = None, colormap: Optional[mbdlyb.colormap.ColorMap] = None) -> networkx.DiGraph Export an MBD network to a NetworkX directed graph. Converts an MBD network structure to a NetworkX DiGraph, optionally filtering by node and relation types. The resulting graph can be used for analysis, visualization, or further processing. :param net: The network to export. :type net: MBDNet :param \*node_types: Node types to include. If empty, includes all MBDNode types. :type \*node_types: Type[MBDNode] :param relation_types: Relation types to include. If None, includes only MBDDependencies. :type relation_types: list[Type[MBDRelation]] :param colormap: Custom color mapping for nodes and relations. Uses default if None. :type colormap: ColorMap :returns: NetworkX directed graph with nodes and edges representing the MBD structure. Each node has 'fqn', 'label', and 'color' attributes. Each edge has 'label' and 'color' attributes. :rtype: nx.DiGraph .. py:function:: export_to_yed(net: mbdlyb.MBDNet, *node_types: Type[mbdlyb.MBDNode], group: Optional[pyyed.Group] = None, is_graph_root: bool = True, colormap: Optional[mbdlyb.colormap.ColorMap] = None) -> pyyed.Graph | pyyed.Group Export an MBD network to yEd graph editor format. Converts an MBD network to a yEd-compatible graph structure for visualization and editing in yEd. Hierarchical subnets are represented as groups, and dependencies and influences are shown as edges. :param net: The network to export. :type net: MBDNet :param \*node_types: Node types to include. If empty, includes all MBDNode types. :type \*node_types: Type[MBDNode] :param group: Parent group for nested export. Omit for root export. :type group: yed.Group :param is_graph_root: Whether this is the root export call. Default is True. :type is_graph_root: bool :param colormap: Custom color mapping for elements. Uses default if None. :type colormap: ColorMap :returns: yEd graph or group structure ready for serialization and editing in the yEd graph editor. :rtype: yed.Graph | yed.Group