Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • 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
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

TensorNetworks

Guides

  • TensorNetworks

Tech Notes

  • Building Tensor Networks
  • Contraction Paths and Execution
  • Matrix Product States
  • A Working Tour of the Symmetry Functions
  • Tensor Networks Overview
  • Young Tableaux and Tensor Symmetries

Symbols

  • ActivateTensors
  • BinaryTensorNetwork
  • BinaryTensorNetworkQ
  • CanonicalPath
  • CanonicalPathQ
  • ContractIndices
  • ContractionTree
  • EinsteinSummation
  • GreedyContractionPath
  • HookFactor
  • HookLength
  • HookLengths
  • IndexedMultiply
  • InitializeTensorNetwork
  • MetricTensor
  • MetricTensorQ
  • MPSCanonicalForm
  • MPSCanonicalQ
  • MPSEntanglementEntropy
  • MPSNormalize
  • MPSNorm
  • MPSOverlap
  • MPSSchmidtValues
  • MPSTruncate
  • OptimalContractionPath
  • PartitionQ
  • PathIndexContractions
  • PathQ
  • PathToTreePath
  • RandomTensorNetwork
  • SchurDimension
  • SparseTensorNetwork
  • TableauColumns
  • TableauDimension
  • TableauRows
  • TableauShape
  • TableauSize
  • TableauWeylDimension
  • TensorNetworkAdd
  • TensorNetworkContraction
  • TensorNetworkContractions
  • TensorNetworkContract
  • TensorNetworkData
  • TensorNetworkDelete
  • TensorNetworkFreeIndices
  • TensorNetworkGraphData
  • TensorNetworkGraphQ
  • TensorNetworkIndexDimensions
  • TensorNetworkIndexGraph
  • TensorNetworkIndices
  • TensorNetwork
  • TensorNetworkQ
  • TensorNetworkRemoveCycles
  • TensorNetworkReplaceIndices
  • TensorNetworkSize
  • TensorNetworkTensors
  • TensorNetworkToNetGraph
  • ToTensorNetworkGraph
  • TransposePartition
  • TreePathQ
  • TreePathToPath
  • YoungProject
  • YoungSymmetrize
  • YoungTableau
  • YoungTableauQ
Wolfram`TensorNetworks`
BinaryTensorNetwork
​
BinaryTensorNetwork
[tn]
returns a binary (pairwise) tensor network equivalent to
tn
, inserting a
SymbolicDeltaProductArray
spider for every index that appears in three or more tensors.
​
Details and Options
▪
When
BinaryTensorNetworkQ
[
tn
] is
True
, the input network is already binary and
BinaryTensorNetwork
returns it unchanged.
▪
Each hyperedge – an index
i
shared by
k≥3
tensors – is replaced by a fresh rank-
k
SymbolicDeltaProductArray
(a copy tensor) that joins the original
k
tensors through new bond indices, leaving every index in the result shared by at most two tensors.
▪
The third slot of
TensorNetwork
– the output index list
tn
[
"Output"
] – is forwarded unchanged to the binary network.
▪
Path-finders
GreedyContractionPath
and
OptimalContractionPath
require a binary network.
TensorNetworkContract
applies
BinaryTensorNetwork
internally on hyperedge inputs; call it directly when feeding a network to a path-finder.
▪
The binarized network contracts to the same tensor as the original, since each inserted
SymbolicDeltaProductArray
spider equals a multidimensional
KroneckerDelta
.
​
Examples  
(9)
Basic Examples  
(2)
Build a three-tensor network in which the index i2 is shared by all three tensors, so the network is not binary:
In[1]:=
tensors=RandomReal[{-1,1},{3,2,2,2}];
In[2]:=
tn=
TensorNetwork
[tensors,{{i1,i2,i3},{i2,i4,i5},{i2,i3,i6}}]
Out[2]=
TensorNetwork
Tensors: 3
Binary: No
Free indices: 4
Sparse: No
Output dimension: 16
​

Test if it is a binary (pairwise) tensor network:
In[3]:=
tn["BinaryQ"]
Out[3]=
False
It is clear from the hypergraph that the index i2 is shared by 3 tensors:
In[4]:=
Quiet[tn["Hypergraph"],ResourceObject::updavb]
Out[4]=
Convert to a binary tensor network. The returned object is itself a
TensorNetwork
object whose summary box reports Binary: Yes:
In[5]:=
bin=
BinaryTensorNetwork
[tn]
Out[5]=
TensorNetwork
Tensors: 4
Binary: Yes
Free indices: 4
Sparse: No
Output dimension: 16
​

After binarization the new network reports the binary property as True and has size larger than the original (one extra spider per hyperedge):
In[6]:=
bin["BinaryQ"]
Out[6]=
True
In[7]:=
TensorNetworkSize
[tn]
Out[7]=
3
In[8]:=
TensorNetworkSize
[bin]
Out[8]=
4
​
Every standard tensor-network topology (MPS, PEPS, TTN, MERA, MPO) produced by RandomTensorNetwork is already binary. Start from an MPS of length 4:
In[1]:=
mps=BlockRandomSeedRandom[1];
RandomTensorNetwork
["MPS"[4,2,2]]
Out[1]=
TensorNetwork
Tensors: 4
Binary: Yes
Free indices: 4
Sparse: No
Output dimension: 16
​

In[2]:=
BinaryTensorNetworkQ
[mps]
Out[2]=
True
On a binary input,
BinaryTensorNetwork
short-circuits and returns the same object unchanged:
In[3]:=
BinaryTensorNetwork
[mps]
Out[3]=
TensorNetwork
Tensors: 4
Binary: Yes
Free indices: 4
Sparse: No
Output dimension: 16
​

Identity is structural, not just numerical:
In[4]:=
BinaryTensorNetwork
[mps]===mps
Out[4]=
True
Scope  
(3)

Applications  
(2)

Properties & Relations  
(2)

SeeAlso
BinaryTensorNetworkQ
 
▪
TensorNetwork
 
▪
RandomTensorNetwork
 
▪
TensorNetworkContract
 
▪
OptimalContractionPath
 
▪
GreedyContractionPath
 
▪
SymbolicDeltaProductArray
 
▪
KroneckerDelta
TechNotes
▪
Building Tensor Networks
RelatedGuides
▪
TensorNetworks
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com