nx2diagram#
Builds a diagram given a networkx graph,
this is called by diagramize().
- param graph:
with nodes for inputs, outputs, boxes and their co/domain.
- type graph:
networkx.DiGraph
- param ob_factory:
e.g.
discopy.monoidal.Tyanddiscopy.monoidal.Id.- type ob_factory:
type
- param id_factory:
e.g.
discopy.monoidal.Tyanddiscopy.monoidal.Id.- type id_factory:
type
- returns:
diagram – Returns the diagram encoded by the graph.
- rtype:
Note
Box nodes with no inputs need an offset attribute.