Order of contractions in a Tensor Diagram

Hi, another naive question from a DMRG newbie: is there any order for contractions implied in tensor network diagrams? Are there any defined rules?

Thank you! :slight_smile:

It’s a good question. Tensor diagrams do not usually contain any information about the order in which they are to be contracted. Figuring out this order is an important role of the programmer when implementing them. While it can be easy to figure out the most efficient ordering by hand for smaller diagrams or ones with obvious structure (like a 1d structure or tree structure) in general it’s a hard (even NP hard) problem and an active area of research.

We already do offer a feature in ITensor that lets you input a set of ITensors to contract then have our backend figure out a best ordering of the contractions. Here is the doc page about it:

More options will be added to this system in the future, such as different algorithms for determining contraction orders (most are heuristic in order to have sufficiently good scaling with the number of tensors in the diagram).

Thank you! :slight_smile: