tensornetwork.contractors.branch(nodes: Iterable[tensornetwork.network_components.AbstractNode], output_edge_order: Optional[Sequence[tensornetwork.network_components.Edge]] = None, memory_limit: Optional[int] = None, nbranch: Optional[int] = None, ignore_edge_order: bool = False) → tensornetwork.network_components.AbstractNode

Branch contraction path via opt_einsum.

This method uses the DFS approach of optimal while sorting potential contractions based on a heuristic cost, in order to reduce time spent in exploring paths which are unlikely to be optimal. More details on branching path.

  • nodes – an iterable of Nodes
  • output_edge_order – An optional list of edges. Edges of the final node in nodes_set are reordered into output_edge_order; if final node has more than one edge, output_edge_order must be provided.
  • memory_limit – Maximum number of elements in an array during contractions.
  • nbranch – Number of best contractions to explore. If None it explores all inner products starting with those that have the best cost heuristic.
  • ignore_edge_order – An option to ignore the output edge order.

The final node after full contraction.