diagram2nx#

discopy.drawing.legacy.diagram2nx(diagram)[source]#

Builds a networkx graph, called by Diagram.draw().

Parameters

diagram (discopy.monoidal.Diagram) – any diagram.

Returns

  • graph (networkx.DiGraph) – with nodes for inputs, outputs, boxes and their co/domain.

  • positions (Mapping[Node, Tuple[float, float]]) – from nodes to pairs of floats.