diagram2nx#

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

param diagram:

any diagram.

type diagram:

discopy.monoidal.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.