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`
CanonicalPath
​
CanonicalPath
[path]
returns the canonical (normalized) form of the contraction
path
.
​
​
CanonicalPath
[path,indices]
uses the explicit index list
indices
for the tree-path round-trip.
​
Details and Options
▪
The canonical form is the opt_einsum convention: a list of integer pairs
{{i,j},…}
where each step removes the tensors at positions
i
,
j
from the working list and appends their contraction at the end.
▪
CanonicalPath
is implemented via
TreePathToPath
[
PathToTreePath
[path,indices],indices]
— the path is converted to a tree path and back, normalizing in the process.
▪
When
indices
is
Automatic
, the required arity is derived from the path as
Count
[path,{_,_}]
+ 1.
▪
CanonicalPath
is used internally by
OptimalContractionPath
and
GreedyContractionPath
to wrap the path-finder output in canonical form.
​
Examples  
(9)
Basic Examples  
(3)
Convert a contraction path with a singleton to canonical form:
In[1]:=
path={{1},{2,3},{1,2}}
In[2]:=
PathQ
[path]
Out[2]=
True
In[3]:=
CanonicalPath
[path]
Out[3]=
{{3,1},{1,2}}
​
Normalize a path that retains a tensor before contracting; the canonical form just names the two tensors to combine:
In[1]:=
CanonicalPath
[{{1},{1,2}}]
Out[1]=
{{2,1}}
​
Pass an explicit index list for the round-trip:
In[1]:=
CanonicalPath
[{{2},{1,2}},{a,b}]
Out[1]=
{{1,2}}
Scope  
(4)

Applications  
(1)

Properties & Relations  
(1)

SeeAlso
PathQ
 
▪
CanonicalPathQ
 
▪
TreePathQ
 
▪
TreePathToPath
 
▪
PathToTreePath
 
▪
PathIndexContractions
 
▪
OptimalContractionPath
 
▪
GreedyContractionPath
 
▪
TensorNetworkContract
TechNotes
▪
Contraction Paths and Execution
RelatedGuides
▪
TensorNetworks
""

© 2026 Wolfram. All rights reserved.

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