raesl.plot.diagrams#

Graphviz diagrams of an ESL specification.

Module Contents#

Functions#

hierarchy_diagram() → graphviz.Digraph)

Draw a hierarchical decomposition tree using Graphviz.

functional_dependency_diagram() → graphviz.Digraph)

Draw a functional dependency diagram using Graphviz.

functional_context_diagram() → graphviz.Digraph)

Draw a functional context diagram using Graphviz.

function_chain_diagram() → graphviz.Digraph)

Draw a function chain diagram using Graphviz.

function_traceability_diagram() → graphviz.Digraph)

Draw a functional traceability diagram using Graphviz.

_draw_migrated_graph(→ graphviz.Digraph)

Get a correctly migrated graphviz.Digraph of a Graph.

_add_component(digraph, node, trans, goals, style)

Adding a component to a Digraph object. Associated goals

_add_cluster(digraph, node, leafs, trans, goals, style)

Adding a cluster to a Digraph object. Associated goals are added as well.

_add_goal(digraph, node, style)

Adding a goal specification to a Digraph object.

_add_transformation(digraph, trans, style)

Adding a transformation specification to a Digraph object.

_get_display_name(→ str)

Get the display name for a Node in the diagram.

_is_clusternode(node, trans, leafs)

Check whether a Node represents a clusternode in the diagram.

raesl.plot.diagrams.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.

Parameters:
  • graph – Instantiated ESL graph.

  • roots – List of root nodes for which a tree must be drawn.

  • levels – Number of levels to include in the tree.

  • style – RaESL style options.

Returns:

Graphviz Digraph object of the decomposition tree.

raesl.plot.diagrams.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.

Parameters:
  • graph – Instantiated ESL graph.

  • root – Root node for which the dependency structure must be drawn.

  • levels – Number of levels to include in the tree.

  • style – RaESL style options.

Returns:

Graphviz Digraph object of the functional dependency diagram.

raesl.plot.diagrams.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.

Parameters:
  • graph – Instantiated ESL graph.

  • root – Root node for which the functional context is drawn.

  • degree – The degree up to which neighbors must be collected (neighbors of neighbors). Defaults to 1.

  • style – RaESL style options.

Returns:

Graphviz Digraph object of the functional context diagram.

raesl.plot.diagrams.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.

Parameters:
  • graph – Instantiated ESL graph.

  • 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.

  • 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.

  • levels – Number of levels to decompose intermediate components into. This number is relative to the depth of the start nodes and end nodes.

  • style – RaESL style options.

Returns:

Graphviz Digraph object of the function chain diagram.

raesl.plot.diagrams.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.

Parameters:
  • graph – Instantiated ESL graph.

  • root – Node that serves a the root of the traceability tree. Must be a transformation specification.

  • levels – Number of levels to go down into the traceability tree.

  • style – RaESL Style options.

Returns

Graphviz Digraph object of the functional traceability diagram.

raesl.plot.diagrams._draw_migrated_graph(view: ragraph.graph.GraphView, roots: List[ragraph.node.Node], style: raesl.plot.generic.Style) graphviz.Digraph#

Get a correctly migrated graphviz.Digraph of a Graph.

Parameters:
  • view – GraphView using one of the ESL filters below.

  • roots – List of root nodes.

  • style – RaESL style options.

raesl.plot.diagrams._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.

Parameters:
  • digraph – Digraph object to add the transformation to.

  • node – The component to be added.

  • trans – Dictionary of component node names to a lists of transformation specifications.

  • goals – Dictionary of component node names to lists of goal specifications.

  • style – RaESL style options.

raesl.plot.diagrams._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.

Parameters:
  • digraph – Digraph object to add the transformation to.

  • node – The component to be added.

  • leafs – Dictionary of leaf node names to leaf nodes.

  • trans – Dictionary of component node names to a lists of transformation specifications.

  • goals – Dictionary of component node names to lists of goal specifications.

  • style – RaESL style options.

raesl.plot.diagrams._add_goal(digraph: graphviz.Digraph, node: ragraph.node.Node, style: raesl.plot.generic.Style)#

Adding a goal specification to a Digraph object.

Parameters:
  • digraph – Digraph object to add the goal specification to.

  • node – The Node corresponding to the goal specification to be added.

  • style – RaESL style options.

raesl.plot.diagrams._add_transformation(digraph: graphviz.Digraph, trans: ragraph.node.Node, style: raesl.plot.generic.Style)#

Adding a transformation specification to a Digraph object.

Parameters:
  • digraph – Digraph object to add the transformation to.

  • trans – The Node corresponding to the transformation specification to be added.

  • style – RaESL style options.

raesl.plot.diagrams._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.

Parameters:
  • node – Node to get the display name for.

  • trans – Dictionary of component node names to a list of transformation specs.

  • leafs – Dictionary of leaf node names to leaf nodes.

Returns:

Display name of the Node.

Note

Clusters are prepended with cluster_.

raesl.plot.diagrams._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.

Parameters:
  • node – Node to get the display name for.

  • trans – Dictionary of component node names to a list of transformation specs.

  • leafs – Dictionary of leaf node names to leaf nodes.

Returns:

Whether the Node represents a clusternode in the diagram.