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`
GreedyContractionPath
​
GreedyContractionPath
[tn]
finds a contraction path through the TensorNetwork
tn
using a greedy cost-minimization heuristic.
​
​
GreedyContractionPath
[graph]
finds a path for a TensorNetwork
Graph
.
​
​
GreedyContractionPath
["Dimensions"dims,"Indices"inds,"Contractions"cs]
finds a path from explicit network data in association form.
​
​
GreedyContractionPath
[expr]
finds a path for an
Inactive
TensorContract
of a
TensorProduct
.
​
​
GreedyContractionPath
[inputs,output,sizeDict]
low-level form taking explicit per-tensor index lists, the output indices, and a size-per-index
Association
.
​
Details and Options
▪
GreedyContractionPath
returns the same canonical path format as
OptimalContractionPath
: a
List
of integer pairs
{i,j}
in opt_einsum convention. At each step the two tensors at positions
i
and
j
are removed and the contraction result is appended at the end of the list.
▪
The greedy search is
(n)
per step in the network size, so it scales to hundreds of tensors where
OptimalContractionPath
is intractable. Paths are not provably optimal but in practice are within a small constant factor.
▪
The search is backed by the Rust library function
"optimize_greedy"
from
Wolfram/PacletExtensions
, loaded on first use through
ExtensionCargo
.
▪
Setting
"Temperature"
to a numeric value enables stochastic local search; combined with
"RandomSeed"
this produces deterministic-but-randomized paths, useful for benchmarking ensembles.
▪
The following options can be given:
"MemoryWeight"
None
weight given to intermediate-tensor memory cost vs. FLOPs
"Temperature"
None
stochastic-search temperature; higher values explore more candidates
"MaxNeighbors"
None
beam width: number of candidate pairs evaluated at each step
"RandomSeed"
None
RNG seed for reproducible randomized paths
"PreSimplify"
None
fuse duplicate indices and trivial dimensions before search
"FixedIndexing"
None
use SSA index allocation in the search
​
Examples  
(16)
Basic Examples  
(1)
Find a greedy contraction path for a small random network:
In[1]:=
tn=BlockRandomSeedRandom[42];
RandomTensorNetwork
[{4,5},3]
Out[1]=
TensorNetwork
Tensors: 4
Binary: Yes
Free indices: 2
Sparse: No
Output dimension: 4
​

In[2]:=
GreedyContractionPath
[tn]
Out[2]=
{{3,4},{1,3},{1,2}}
Scope  
(4)

Options  
(6)

Applications  
(2)

Properties & Relations  
(3)

SeeAlso
OptimalContractionPath
 
▪
TensorNetworkContract
 
▪
TensorNetworkContraction
 
▪
CanonicalPath
 
▪
PathQ
 
▪
ContractionTree
 
▪
BinaryTensorNetwork
TechNotes
▪
Contraction Paths and Execution
RelatedGuides
▪
TensorNetworks
""

© 2026 Wolfram. All rights reserved.

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