Skip to content

rs_rich.diagram

Generated from the type stubs by scripts/gen_python_api.py; do not edit.

rs_rich.diagram: graph diagrams (rs-rich-diagram; no Rich counterpart).

Graph is a graph built in code: node and edge add to it and return it, so calls chain. Diagram draws one with box-drawing characters (or ASCII), laid out in layers; draw_graph gives the lines. Dot draws a DOT (Graphviz) source natively, and parse_dot reads one, raising DotError with the line (and the unsupported construct).

DIAGRAM_MAX_EDGE_LENGTH module-attribute

DIAGRAM_MAX_EDGE_LENGTH: int

Node module-attribute

Node = DiagramNode

Edge module-attribute

Edge = DiagramEdge

Cluster module-attribute

Cluster = DotCluster

MAX_EDGE_LENGTH module-attribute

MAX_EDGE_LENGTH = DIAGRAM_MAX_EDGE_LENGTH

draw module-attribute

draw = draw_graph

parse module-attribute

parse = parse_dot

Diagram

graph property

graph: Graph

ascii property

ascii: Optional[bool]

drawing

drawing(ascii: bool = False) -> List[str]

DiagramEdge

source property

source: int

target property

target: int

label property

label: Optional[str]

stroke property

stroke: str

start property

start: Optional[str]

end property

end: Optional[str]

length property

length: int

DiagramError

Bases: Exception

The base of the diagram errors.

DiagramLayoutError

Bases: DiagramError

A graph too large to lay out.

DiagramNode

id property

id: str

label property

label: str

shape property

shape: str

Dot

source property

source: str

ascii property

ascii: Optional[bool]

parsed

parsed() -> DotGraph

DotCluster

id property

id: str

label property

label: Optional[str]

nodes property

nodes: List[int]

DotError

Bases: DiagramError

A DOT source could not be read: line is where, and construct names what this parser does not support (None for a syntax error).

line instance-attribute

line: int

construct instance-attribute

construct: Optional[str]

DotGraph

graph property

graph: Graph

directed property

directed: bool

strict property

strict: bool

name property

name: Optional[str]

label property

label: Optional[str]

clusters property

clusters: List[DotCluster]

notes property

notes: List[str]

Graph

direction instance-attribute

direction: str

nodes property

nodes: List[DiagramNode]

edges property

edges: List[DiagramEdge]

node

node(id: str, label: Optional[str] = None, *, shape: str = 'rect') -> Graph

edge

edge(source: str, target: str, *, label: Optional[str] = None, stroke: Literal['solid', 'thick', 'dotted', 'invisible'] = 'solid', start: DiagramHead = None, end: DiagramHead = 'arrow', min_length: int = 1) -> Graph
link(source: str, target: str, *, label: Optional[str] = None) -> Graph

node_index

node_index(id: str) -> Optional[int]

draw_graph

draw_graph(graph: Graph, ascii: bool = False) -> List[str]

parse_dot

parse_dot(source: str) -> DotGraph