reno.diagrams.DiagramEdge#

class reno.diagrams.DiagramEdge(source, target)#

Bases: object

A visual connection between nodes (references) in a stock and flow diagram.

Edge information stands outside of an individual diagram instance since there can be crossmodel/intermodel connections. Edges are stored as separate instances so that the nodes on both ends can share the edge objects.

Methods

__init__(source, target)

Create an edge instance that connects from the passed source node to the passed target node.

add_to_graphviz([g])

Add this edge to the graphviz Digraph.

configure_color(config)

Determine what color should be used for this edge given the configuration.

find_duplicate_edges()

Get all other edges between the same source and target.

mark_rendered()

Set rendered state of this edge (and all duplicate/similar edges) to True.

other(node)

Given one side of the edge, get the node at the other end.

should_render()

Determine if this edge should be rendered or not.

Attributes

PRIORITY

When two edges can be drawn between the same source and target, priority (based on type) is used to determine which edge is actually drawn.

arrowsize

default_color

style

weight

rendered

Flag to ensure an edge doesn't get double-rendered.

Parameters:
PRIORITY: int = 0#

When two edges can be drawn between the same source and target, priority (based on type) is used to determine which edge is actually drawn.

__annotations__ = {'PRIORITY': 'int', 'arrowsize': 'ClassVar[str]', 'default_color': 'ClassVar[dict[str, str]]', 'style': 'ClassVar[str]', 'weight': 'ClassVar[str]'}#
__dict__ = mappingproxy({'__module__': 'reno.diagrams', '__annotations__': {'default_color': 'ClassVar[dict[str, str]]', 'style': 'ClassVar[str]', 'weight': 'ClassVar[str]', 'arrowsize': 'ClassVar[str]', 'PRIORITY': 'int'}, '__doc__': 'A visual connection between nodes (references) in a stock and flow diagram.\n\n    Edge information stands outside of an individual diagram instance since there can be\n    crossmodel/intermodel connections. Edges are stored as separate instances so that\n    the nodes on both ends can share the edge objects.\n    ', 'default_color': {'light': 'black', 'dark': 'white'}, 'style': None, 'weight': None, 'arrowsize': None, 'PRIORITY': 0, '__init__': <function DiagramEdge.__init__>, 'configure_color': <function DiagramEdge.configure_color>, 'other': <function DiagramEdge.other>, 'should_render': <function DiagramEdge.should_render>, 'mark_rendered': <function DiagramEdge.mark_rendered>, 'find_duplicate_edges': <function DiagramEdge.find_duplicate_edges>, 'add_to_graphviz': <function DiagramEdge.add_to_graphviz>, '__dict__': <attribute '__dict__' of 'DiagramEdge' objects>, '__weakref__': <attribute '__weakref__' of 'DiagramEdge' objects>})#
__module__ = 'reno.diagrams'#
__weakref__#

list of weak references to the object

add_to_graphviz(g=None)#

Add this edge to the graphviz Digraph.

Parameters:

g (Digraph)

Return type:

None

arrowsize: ClassVar[str] = None#
configure_color(config)#

Determine what color should be used for this edge given the configuration.

Parameters:

config (RenderConfig)

Return type:

None

default_color: ClassVar[dict[str, str]] = {'dark': 'white', 'light': 'black'}#
find_duplicate_edges()#

Get all other edges between the same source and target.

Only includes those pointing the same direction. The list does not include this current edge.

Return type:

list[DiagramEdge]

mark_rendered()#

Set rendered state of this edge (and all duplicate/similar edges) to True.

Without this, “duplicate” edges will sometimes still render.

Return type:

None

other(node)#

Given one side of the edge, get the node at the other end.

Parameters:

node (DiagramNode)

Return type:

DiagramNode

rendered#

Flag to ensure an edge doesn’t get double-rendered.

should_render()#

Determine if this edge should be rendered or not.

This determination is based on whether both end nodes are supposed to render, and if any other edges between those same nodes have already rendered.

Return type:

bool

style: ClassVar[str] = None#
weight: ClassVar[str] = None#