Repository: google/TensorNetwork

Issue:
`auto` calls `branch` with incorrect number of parameters when n >= 5 and n < 7
https://github.com/google/TensorNetwork/blob/003fdc789afa006e08f12818ad76c5f31828aa69/tensornetwork/contractors/opt_einsum_paths/path_contractors.py#L243

The `branch` method accepts 5 parameters, but here is called with 4. This results in the `ignore_edge_order` parameter being passed into `branch` as `nbranch` and an inability to set `ignore_edge_order` when `n >=5 and n < 7`



Discussion:
Seems like a quick fix. Wanna do a PR?
Yup, doing now

Resolving patch:
diff --git a/tensornetwork/contractors/opt_einsum_paths/path_contractors.py b/tensornetwork/contractors/opt_einsum_paths/path_contractors.py
--- a/tensornetwork/contractors/opt_einsum_paths/path_contractors.py
+++ b/tensornetwork/contractors/opt_einsum_paths/path_contractors.py
@@ -240,11 +240,21 @@ def auto(
   if n < 5:
     return optimal(nodes, output_edge_order, memory_limit, ignore_edge_order)
   if n < 7:
-    return branch(nodes, output_edge_order, memory_limit, ignore_edge_order)
+    return branch(nodes,
+                  output_edge_order=output_edge_order,
+                  memory_limit=memory_limit,
+                  ignore_edge_order=ignore_edge_order)
   if n < 9:
-    return branch(nodes, output_edge_order, memory_limit, nbranch=2, ignore_edge_order=ignore_edge_order)
+    return branch(nodes,
+                  output_edge_order=output_edge_order,
+                  memory_limit=memory_limit,
+                  nbranch=2,
+                  ignore_edge_order=ignore_edge_order)
   if n < 15:
-    return branch(nodes, output_edge_order, nbranch=1, ignore_edge_order=ignore_edge_order)
+    return branch(nodes,
+                  output_edge_order=output_edge_order,
+                  nbranch=1,
+                  ignore_edge_order=ignore_edge_order)
   return greedy(nodes, output_edge_order, memory_limit, ignore_edge_order)
 
 


Test patch:
diff --git a/tensornetwork/contractors/opt_einsum_paths/path_contractors_node_test.py b/tensornetwork/contractors/opt_einsum_paths/path_contractors_node_test.py
--- a/tensornetwork/contractors/opt_einsum_paths/path_contractors_node_test.py
+++ b/tensornetwork/contractors/opt_einsum_paths/path_contractors_node_test.py
@@ -15,6 +15,7 @@
 import numpy as np
 import pytest
 from tensornetwork import Node
+from tensornetwork.contractors import auto
 from tensornetwork.contractors.opt_einsum_paths import path_contractors
 
 
@@ -178,6 +179,22 @@ def test_disconnected_network(backend, path_algorithm):
   g[0] ^ f[1]
   final_edges = [a[0], b[1], c[1], d[0], e[1], g[1]]
   result = path_algorithm(
-      {a, b, c, d, e, f, g}, 
+      {a, b, c, d, e, f, g},
       final_edges)
   assert result.edges == final_edges
+
+def test_passes_ignore_edge_order_from_auto(backend):
+  a = Node(np.eye(2), backend=backend)
+  b = Node(np.eye(2), backend=backend)
+  c = Node(np.eye(2), backend=backend)
+  d = Node(np.eye(2), backend=backend)
+  e = Node(np.eye(2), backend=backend)
+  # pylint: disable=pointless-statement
+  a[1] ^ b[0]
+  c[0] ^ d[1]
+  c[1] ^ e[0]
+  nodes = [a, b, c, d, e]
+  try:
+    auto(nodes, ignore_edge_order=True)
+  except ValueError:
+    pytest.fail("auto should pass ignore_edge_order when n >= 5 && n < 7")