In Stim, we can get a detector graph with the probability of each error mechanism occurring. Now I want to construct a path graph from the detector graph, which is usually done by Dijkstra's algorithm. What is the easiest way to implement Dijkstra's algorithm and get the path graph with each path having weight (=the sum of the corresponding edge weights (defined by -log p) in the detector graph) from detector_error_model?
$\begingroup$
$\endgroup$
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
1
The easiest way is to write glue code that iterates over the detector error model, converting error instructions into the edges of a networkx graph. Then use networkx for graph transformations like obtaining the path graph.
-
$\begingroup$ Thank you, but I have one more question. I know that
pymatching.Matching.edges()gives edge weights of edges in the detector graph. However, I couldn't find a way to obtain the edge weights of edges in the path graph using networkx. Do you know how to do it? Thank you in advance. $\endgroup$david– david2024-08-28 14:47:28 +00:00Commented Aug 28, 2024 at 14:47