-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Description
Causal-flow finding algorithm is implemented in a recursive fashion following the presentation in the original publication (see references in the source code). Linear open graphs with RecursionError exception on a MacBook Air M4, 24 GB running OS 15.7.3.
The following code snippet allows to reproduce the issue:
import networkx as nx
from graphix.fundamentals import Plane
from graphix.opengraph import OpenGraph
def create_line_og(n_nodes: int) -> OpenGraph[Plane]:
if n_nodes < 2:
raise ValueError("n_nodes must be larger than 1.")
graph: nx.Graph[int] = nx.Graph([(i, i + 1) for i in range(n_nodes - 1)])
input_nodes = [0]
output_nodes = [n_nodes - 1]
measurements = dict.fromkeys(range(n_nodes - 1), Plane.XY)
return OpenGraph(graph, input_nodes, output_nodes, measurements)
n_nodes = 990
while True:
og = create_line_og(n_nodes)
try:
og.extract_causal_flow()
except RecursionError:
break
n_nodes += 1
print(f"Recursion limit hit at {n_nodes}")Note that a flow correction function can be found for these graphs with the cubic Pauli-flow finding algorithm.
Since the recursion in the causal-flow finding algorithm is terminal, it should be possible to rewrite the algorithm in an iterative fashion without needing to represent the stack in a custom data structure.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working