Wolfram Language
Paclet Repository
Community-contributed installable additions to the Wolfram Language
Primary Navigation
Categories
Cloud & Deployment
Core Language & Structure
Data Manipulation & Analysis
Engineering Data & Computation
External Interfaces & Connections
Financial Data & Computation
Geographic Data & Computation
Geometry
Graphs & Networks
Higher Mathematical Computation
Images
Knowledge Representation & Natural Language
Machine Learning
Notebook Documents & Presentation
Scientific and Medical Data & Computation
Social, Cultural & Linguistic Data
Strings & Text
Symbolic & Numeric Computation
System Operation & Setup
Time-Related Computation
User Interface Construction
Visualization & Graphics
Random Paclet
Alphabetical List
Using Paclets
Create a Paclet
Get Started
Download Definition Notebook
Learn More about
Wolfram Language
DiagrammaticComputation
Tutorials
Diagram Examples
Introduction to Diagrammatic Computation
Rewriting Diagrams
Guides
Converting To and From Diagrams
Drawing Diagrams Interactively
Diagram Grid Layout
Diagram Rewriting
Diagrams
Diagram Surgery
Feynman Diagrams
Ports
Symbols
AnnihilationRule
CapDiagram
ColumnDiagram
CommutationRule
CopyDiagram
CupDiagram
DiagramArrange
DiagramAssignPorts
DiagramCases
DiagramComposition
DiagramCopySplit
DiagramDecompose
DiagramDelete
DiagramDraw
DiagramDual
DiagramExpressionReplace
DiagramExtract
DiagramFlip
DiagramFunction
DiagramGraphics
DiagramGraphSimplify
DiagramGridHeight
DiagramGrid
DiagramGridTree
DiagramGridWidthHeight
DiagramGridWidth
DiagramHypergraph
DiagramHypergraphRule
DiagramInsert
DiagramMapAt
DiagramMap
DiagramMatchPorts
Diagram
DiagramNestReplace
DiagramNetwork
DiagramPattern
DiagramPermute
DiagramPosition
DiagramPositions
DiagramProduct
DiagramQ
DiagramReplaceList
DiagramReplace
DiagramReplacePart
DiagramReverse
DiagramRightComposition
DiagramRule
DiagramsFreePorts
DiagramsGraph
DiagramsNetGraph
DiagramSplit
DiagramsPortGraph
DiagramSubdiagrams
DiagramSum
DiagramTensor
DuplicateAnnihilationRule
DuplicateEraserRule
EmptyDiagram
EmptyDiagramQ
EmptyPortQ
EraserAnnihilationRule
EraserDiagram
EraserRule
FeynArtsTopologyGraphics
FeynmanDiagram
GridInputPorts
GridOutputPorts
IdentityDiagram
MergeDiagram
PermutationDiagram
PortDual
PortMinus
Port
PortNeutral
PortPower
PortProduct
PortQ
PortSum
PropagationRule
RemoveDiagramRule
RowDiagram
SimplifyDiagram
SingletonDiagram
SpiderDiagram
TagPort
TensorDiagram
ToDiagram
ToDiagramNetwork
TopologyGraphics
TopologyGraph
TopologyGraphs
UntagPort
WigglyArcFunction
ZeroDiagram
ZeroPortQ
Wolfram`DiagrammaticComputation`
D
i
a
g
r
a
m
S
p
l
i
t
D
i
a
g
r
a
m
S
p
l
i
t
[
d
,
n
]
r
e
p
a
r
t
i
t
i
o
n
s
t
h
e
p
o
r
t
s
o
f
d
s
o
t
h
a
t
i
t
s
f
i
r
s
t
n
p
o
r
t
s
b
e
c
o
m
e
o
u
t
p
u
t
s
a
n
d
t
h
e
r
e
m
a
i
n
i
n
g
o
n
e
s
i
n
p
u
t
s
.
D
i
a
g
r
a
m
S
p
l
i
t
[
d
]
t
u
r
n
s
e
v
e
r
y
p
o
r
t
i
n
t
o
a
n
o
u
t
p
u
t
,
m
a
k
i
n
g
d
a
s
t
a
t
e
.
D
i
a
g
r
a
m
S
p
l
i
t
[
d
,
n
,
d
u
a
l
Q
]
c
o
n
t
r
o
l
s
w
h
e
t
h
e
r
t
h
e
m
o
v
e
d
p
o
r
t
s
a
r
e
d
u
a
l
i
s
e
d
.
D
i
a
g
r
a
m
S
p
l
i
t
[
d
,
n
,
d
u
a
l
Q
,
f
l
i
p
Q
]
b
e
n
d
s
t
h
e
m
o
v
e
d
w
i
r
e
s
a
r
o
u
n
d
t
h
e
o
t
h
e
r
s
i
d
e
.
D
e
t
a
i
l
s
a
n
d
O
p
t
i
o
n
s
▪
Ports are counted in the flattened order: outputs first, then inputs. A negative
n
counts back from the total arity,
-
I
n
f
i
n
i
t
y
makes every port an input, and the default
I
n
f
i
n
i
t
y
makes every port an output.
▪
The repartitioning composes
d
with a pure wire diagram that bends the moved ports around, so the underlying process is unchanged — this is the diagrammatic analogue of currying a function or transposing tensor legs between covariant and contravariant positions.
▪
With
d
u
a
l
Q
set to
F
a
l
s
e
, the moved ports keep their direction and are wrapped in
P
o
r
t
D
u
a
l
instead.
▪
With
f
l
i
p
Q
set to
T
r
u
e
, the bending wires pass on the opposite side of the retained ports.
Examples
(
2
)
Basic Examples
(
1
)
Make all five ports of a process into outputs:
I
n
[
1
]
:
=
D
i
a
g
r
a
m
S
p
l
i
t
D
i
a
g
r
a
m
[
A
,
{
a
,
b
,
c
}
,
{
x
,
y
}
]
O
u
t
[
1
]
=
Repartition to three outputs and two inputs:
I
n
[
2
]
:
=
D
i
a
g
r
a
m
S
p
l
i
t
D
i
a
g
r
a
m
[
A
,
{
a
,
b
,
c
}
,
{
x
,
y
}
]
,
3
O
u
t
[
2
]
=
Turn the process into a costate, with every port an input:
I
n
[
3
]
:
=
D
i
a
g
r
a
m
S
p
l
i
t
D
i
a
g
r
a
m
[
A
,
{
a
,
b
,
c
}
,
{
x
,
y
}
]
,
0
O
u
t
[
3
]
=
P
r
o
p
e
r
t
i
e
s
&
R
e
l
a
t
i
o
n
s
(
1
)
S
e
e
A
l
s
o
D
i
a
g
r
a
m
P
e
r
m
u
t
e
▪
D
i
a
g
r
a
m
F
l
i
p
▪
C
a
p
D
i
a
g
r
a
m
▪
C
u
p
D
i
a
g
r
a
m
▪
D
i
a
g
r
a
m
T
e
n
s
o
r
R
e
l
a
t
e
d
G
u
i
d
e
s
▪
D
i
a
g
r
a
m
s
"
"