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
  • 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
  • SparseTensorNetwork
  • TableauColumns
  • TableauDimension
  • TableauRows
  • TableauShape
  • TableauSize
  • 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`
TensorNetworkAdd
​
TensorNetworkAdd
[tn,tensor,indices]
appends
tensor
to the tensor network
tn
with the given hyperedge
indices
. •
​
​
TensorNetworkAdd
[graph,tensor,index]
appends
tensor
to a
ToTensorNetworkGraph
annotated graph, connecting it at
index
. •
​
​
TensorNetworkAdd
[graph,
Labeled
[tensor,label],index]
attaches a vertex
label
in the Graph form. •
​
​
TensorNetworkAdd
[graph,tensor]
selects indices automatically from the current free indices of
graph
.
​
Details and Options
​
Examples  
(10)
Basic Examples  
(1)
Build a triangle tensor network with three free indices contracted pairwise:
In[]:=
t1=RandomReal[1,{2,3}];t2=RandomReal[1,{3,4}];t3=RandomReal[1,{4,2}];t4=RandomReal[1,{2,2}];tn=TensorNetwork[{t1,t2,t3},{{idx1,idx2},{idx2,idx3},{idx3,idx1}}]
Out[]=
TensorNetwork
Tensors: 3
Binary: Yes
Free indices: 0
Sparse: No
Output dimension: 1
​

Append a fourth tensor sharing index idx1; idx1 becomes contracted and idx5 enters the free-index set:
In[]:=
newTN=TensorNetworkAdd[tn,t4,{idx1,idx5}]
Out[]=
TensorNetwork
Tensors: 4
Binary: No
Free indices: 1
Sparse: No
Output dimension: 2
​

Append the same tensor on two fresh indices instead, leaving the existing network untouched and adding two new free indices:
In[]:=
TensorNetworkAdd[tn,t4,{newA,newB}]
Out[]=
TensorNetwork
Tensors: 4
Binary: Yes
Free indices: 2
Sparse: No
Output dimension: 4
​

Move to the annotated Graph form via ToTensorNetworkGraph and inspect its free indices:
In[]:=
chain=TensorNetwork[{RandomReal[1,{2,3}],RandomReal[1,{3,4}]},{{a,b},{b,c}}];g=ToTensorNetworkGraph[chain]
Out[]=
Append a rank-2 tensor to the Graph at one of its free legs; the result is a new annotated Graph:
In[]:=
TensorNetworkAdd[g,extraTensor5,{Superscript[1,1]}]
Out[]=
Scope  
(4)

Applications  
(2)

Properties & Relations  
(3)

SeeAlso
TensorNetworkDelete
 
▪
TensorNetwork
 
▪
TensorNetworkReplaceIndices
 
▪
ToTensorNetworkGraph
 
▪
TensorNetworkFreeIndices
 
▪
Append
 
▪
Labeled
TechNotes
▪
Building Tensor Networks
RelatedGuides
▪
TensorNetworks
""

© 2026 Wolfram. All rights reserved.

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