schematic.utils.viz_utils

viz utils

 1"""viz utils"""
 2
 3from typing import Iterable, Optional, Sequence
 4
 5import graphviz  # type: ignore
 6
 7
 8def visualize(
 9    edges: Iterable[Sequence[str]], size: Optional[float] = None
10) -> graphviz.Digraph:
11    """Creates a digraph with an edge for every edge in the edges input
12
13    Args:
14        edges (Iterable[Sequence[str]]): Any iterable type that contains
15          indexable types with at least two strings
16        size (Optional[float], optional): Defaults to None.
17
18    Returns:
19        graphviz.Digraph:
20    """
21    if size:
22        digraph = graphviz.Digraph(graph_attr=[("size", size)])
23    else:
24        digraph = graphviz.Digraph()
25
26    for item in edges:
27        digraph.edge(item[0], item[1])
28    return digraph
def visualize( edges: Iterable[Sequence[str]], size: Optional[float] = None) -> graphviz.graphs.Digraph:
 9def visualize(
10    edges: Iterable[Sequence[str]], size: Optional[float] = None
11) -> graphviz.Digraph:
12    """Creates a digraph with an edge for every edge in the edges input
13
14    Args:
15        edges (Iterable[Sequence[str]]): Any iterable type that contains
16          indexable types with at least two strings
17        size (Optional[float], optional): Defaults to None.
18
19    Returns:
20        graphviz.Digraph:
21    """
22    if size:
23        digraph = graphviz.Digraph(graph_attr=[("size", size)])
24    else:
25        digraph = graphviz.Digraph()
26
27    for item in edges:
28        digraph.edge(item[0], item[1])
29    return digraph

Creates a digraph with an edge for every edge in the edges input

Arguments:
  • edges (Iterable[Sequence[str]]): Any iterable type that contains indexable types with at least two strings
  • size (Optional[float], optional): Defaults to None.
Returns:

graphviz.Digraph: