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`
PathIndexContractions
​
PathIndexContractions
[path,indices]
returns the sequence of index sets contracted at each step of
path
, given the per-tensor index lists
indices
.
​
​
PathIndexContractions
[path,indices,contractions]
returns the symbolic index sums at each step, mapping the integer positions in
indices
back to the labels in
contractions
.
​
​
PathIndexContractions
[path,data]
takes an association with keys
"Indices"
and
"Contractions"
, such as
tn["Data"]
.
​
Details and Options
▪
At each path step
{i,j}
, the function computes the intersection of
indices〚i〛
and
indices〚j〛
— the indices that get contracted away at that step — and replaces the two tensor entries with the union of their remaining indices.
▪
The result is a list of per-step contraction sets. Each entry is the set of indices summed at that step. Outer-product steps (no shared indices) produce an empty contraction and are removed from the output, so the result length is at most
Length
[path]
.
▪
In the 2-argument form, contractions are tracked by integer position within each tensor's index list. In the 3-argument form, the additional
contractions
argument supplies symbolic labels (e.g. bond names) that the integer positions are mapped back to, which is useful for tracing each contraction to a user-specified index name.
▪
The association form accepts any value with keys
"Indices"
and
"Contractions"
, and returns the catenated symbolic contractions. A
TensorNetwork
object exposes such an association via
tn["Data"]
.
▪
PathIndexContractions
is used internally by
ContractionTree
and by cost-estimation utilities that compare contraction paths.
▪
The length of
indices
must equal
Length
[path]
+ 1. A mismatch issues
PathIndexContractions
::indlen
and returns
$Failed
. For a network with hyper-edges, use the binarized form:
BinaryTensorNetwork
[tn]["Hyperedges"]
.
Examples  
(6)
Basic Examples  
(1)
Find the indices contracted at each step of a path with integer index lists:
In[1]:=
PathIndexContractions
[{{1,2},{1,2}},{{1,2},{2,3},{3,4}}]
Out[2]=
{{2},{3}}
​
Supply symbolic labels to recover the original index names at each step:
In[1]:=
PathIndexContractions
[{{1,2},{1,2}},{{1,2},{2,3},{3,4}},{{"a","b"},{"b","c"},{"c","d"}}]
Out[2]=
{{b},{c}}
​
Pass a tensor network's data association directly:
In[1]:=
SeedRandom[42]
In[2]:=
tn=
RandomTensorNetwork
["MPS"[4,3,2]]
In[3]:=
path=
GreedyContractionPath
[tn]
Out[4]=
{{2,3},{1,3},{1,2}}
In[5]:=
PathIndexContractions
[path,tn["Data"]]
Out[6]=
{{4,6},{1,3},{7,9}}
Scope  
(3)

Applications  
(1)

Properties & Relations  
(1)

SeeAlso
CanonicalPath
 
▪
PathQ
 
▪
TreePathQ
 
▪
ContractionTree
 
▪
TensorNetworkContractions
 
▪
OptimalContractionPath
 
▪
GreedyContractionPath
TechNotes
▪
Contraction Paths and Execution
RelatedGuides
▪
TensorNetworks
""

© 2026 Wolfram. All rights reserved.

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