Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
Abstract compositional diagrammatic calculus
Contributed by: Nik Murzin, Ian Ford
The paclet provides Diagram and Port with constructors ToDiagram, TensorDiagram, IdentityDiagram, PermutationDiagram, CapDiagram, CupDiagram, CopyDiagram, SpiderDiagram; compositions DiagramComposition, DiagramProduct, DiagramSum, DiagramNetwork, RowDiagram, ColumnDiagram; transformations DiagramDual, DiagramFlip, DiagramReverse, DiagramArrange, SimplifyDiagram; conversions DiagramFunction, DiagramTensor; surgery DiagramCases, DiagramMap, DiagramMapAt, DiagramExtract, DiagramInsert, DiagramDelete; and rewriting DiagramReplace, DiagramReplaceList, DiagramNestReplace, DiagramRule.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["Wolfram/DiagrammaticComputation"]
To load the code after installation, evaluate this code:
Needs["Wolfram`DiagrammaticComputation`"]
Create a simple diagram with one input and two output ports:
| In[1]:= |
| Out[1]= | ![]() |
Compose diagrams in sequence and in parallel; matching port names wire together:
| In[2]:= | ![]() |
| Out[2]= | ![]() |
Wire diagrams into a network, joining all equivalent ports regardless of position:
| In[3]:= |
| Out[3]= | ![]() |
Annotate diagram labels with functions and run the diagram as a dataflow:
| In[4]:= | ![]() |
| Out[4]= |
Extract the tensor contraction a composite diagram represents:
| In[5]:= |
| Out[5]= |
Rewrite a diagram by a rule with pattern ports:
| In[6]:= | ![]() |
| Out[6]= | ![]() |
Wolfram Language Version 15.0