nx2diagram#

discopy.drawing.legacy.nx2diagram(graph, factory)[source]#

Builds a diagram given a networkx graph, this is called by diagramize().

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

  • factory (type) – e.g. discopy.monoidal.Diagram.

Return type

monoidal.Diagram

Note

Box nodes with no inputs need an offset attribute.