:py:mod:`raesl.plot.diagrams` ============================= .. py:module:: raesl.plot.diagrams .. autoapi-nested-parse:: Graphviz diagrams of an ESL specification. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: raesl.plot.diagrams.hierarchy_diagram raesl.plot.diagrams.functional_dependency_diagram raesl.plot.diagrams.functional_context_diagram raesl.plot.diagrams.function_chain_diagram raesl.plot.diagrams.function_traceability_diagram raesl.plot.diagrams._draw_migrated_graph raesl.plot.diagrams._add_component raesl.plot.diagrams._add_cluster raesl.plot.diagrams._add_goal raesl.plot.diagrams._add_transformation raesl.plot.diagrams._get_display_name raesl.plot.diagrams._is_clusternode .. py:function:: hierarchy_diagram(graph: ragraph.graph.Graph, roots: List[ragraph.node.Node], levels: int, style: raesl.plot.generic.Style = Style()) -> graphviz.Digraph Draw a hierarchical decomposition tree using Graphviz. :param graph: Instantiated ESL graph. :param roots: List of root nodes for which a tree must be drawn. :param levels: Number of levels to include in the tree. :param style: RaESL style options. :returns: Graphviz Digraph object of the decomposition tree. .. py:function:: functional_dependency_diagram(graph: ragraph.graph.Graph, root: ragraph.node.Node, levels: int, style: raesl.plot.generic.Style = Style()) -> graphviz.Digraph Draw a functional dependency diagram using Graphviz. :param graph: Instantiated ESL graph. :param root: Root node for which the dependency structure must be drawn. :param levels: Number of levels to include in the tree. :param style: RaESL style options. :returns: Graphviz Digraph object of the functional dependency diagram. .. py:function:: functional_context_diagram(graph: ragraph.graph.Graph, root: ragraph.node.Node, degree: int = 1, style: raesl.plot.generic.Style = Style()) -> graphviz.Digraph Draw a functional context diagram using Graphviz. :param graph: Instantiated ESL graph. :param root: Root node for which the functional context is drawn. :param degree: The degree up to which neighbors must be collected (neighbors of neighbors). Defaults to 1. :param style: RaESL style options. :returns: Graphviz Digraph object of the functional context diagram. .. py:function:: function_chain_diagram(graph: ragraph.graph.Graph, start_points: List[Tuple[ragraph.node.Node, List[ragraph.node.Node]]], end_points: List[Tuple[ragraph.node.Node, List[ragraph.node.Node]]], levels: int = 1, style: raesl.plot.generic.Style = Style()) -> graphviz.Digraph Draw a function chain diagram using Graphviz. :param graph: Instantiated ESL graph. :param start_points: List of tuples that contain the component node and list of function nodes that serve as the starting point of the function chains. :param end_points: List of tuples that contain the component node and list of function nodes that serve as the end point of the function chains. :param levels: Number of levels to decompose intermediate components into. This number is relative to the depth of the start nodes and end nodes. :param style: RaESL style options. :returns: Graphviz Digraph object of the function chain diagram. .. py:function:: function_traceability_diagram(graph: ragraph.graph.Graph, root: ragraph.node.Node, levels: int, style: raesl.plot.generic.Style = Style()) -> graphviz.Digraph Draw a functional traceability diagram using Graphviz. :param graph: Instantiated ESL graph. :param root: Node that serves a the root of the traceability tree. Must be a transformation specification. :param levels: Number of levels to go down into the traceability tree. :param style: RaESL Style options. Returns Graphviz Digraph object of the functional traceability diagram. .. py:function:: _draw_migrated_graph(view: ragraph.graph.GraphView, roots: List[ragraph.node.Node], style: raesl.plot.generic.Style) -> graphviz.Digraph Get a correctly migrated :obj:`graphviz.Digraph` of a :obj:`Graph`. :param view: GraphView using one of the ESL filters below. :param roots: List of root nodes. :param style: RaESL style options. .. py:function:: _add_component(digraph: graphviz.Digraph, node: ragraph.node.Node, trans: Dict[str, List[ragraph.node.Node]], goals: Dict[str, List[ragraph.node.Node]], style: raesl.plot.generic.Style) Adding a component to a Digraph object. Associated goals and transformations are added as well. :param digraph: Digraph object to add the transformation to. :param node: The component to be added. :param trans: Dictionary of component node names to a lists of transformation specifications. :param goals: Dictionary of component node names to lists of goal specifications. :param style: RaESL style options. .. py:function:: _add_cluster(digraph: graphviz.Digraph, node: ragraph.node.Node, leafs: Dict[str, ragraph.node.Node], trans: Dict[str, List[ragraph.node.Node]], goals: Dict[str, List[ragraph.node.Node]], style: raesl.plot.generic.Style) Adding a cluster to a Digraph object. Associated goals are added as well. Children are added recursively. :param digraph: Digraph object to add the transformation to. :param node: The component to be added. :param leafs: Dictionary of leaf node names to leaf nodes. :param trans: Dictionary of component node names to a lists of transformation specifications. :param goals: Dictionary of component node names to lists of goal specifications. :param style: RaESL style options. .. py:function:: _add_goal(digraph: graphviz.Digraph, node: ragraph.node.Node, style: raesl.plot.generic.Style) Adding a goal specification to a Digraph object. :param digraph: Digraph object to add the goal specification to. :param node: The Node corresponding to the goal specification to be added. :param style: RaESL style options. .. py:function:: _add_transformation(digraph: graphviz.Digraph, trans: ragraph.node.Node, style: raesl.plot.generic.Style) Adding a transformation specification to a Digraph object. :param digraph: Digraph object to add the transformation to. :param trans: The Node corresponding to the transformation specification to be added. :param style: RaESL style options. .. py:function:: _get_display_name(node: ragraph.node.Node, trans: Dict[str, List[str]], leafs: Dict[str, ragraph.node.Node]) -> str Get the display name for a Node in the diagram. :param node: Node to get the display name for. :param trans: Dictionary of component node names to a list of transformation specs. :param leafs: Dictionary of leaf node names to leaf nodes. :returns: Display name of the Node. .. note:: Clusters are prepended with ``cluster_``. .. py:function:: _is_clusternode(node: ragraph.node.Node, trans: Dict[str, List[str]], leafs: Dict[str, ragraph.node.Node]) Check whether a Node represents a clusternode in the diagram. :param node: Node to get the display name for. :param trans: Dictionary of component node names to a list of transformation specs. :param leafs: Dictionary of leaf node names to leaf nodes. :returns: Whether the Node represents a clusternode in the diagram.