Skip to content

Commit

Permalink
Update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarhiggott committed Sep 5, 2021
1 parent e72ee3b commit dc736a3
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/pymatching/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,25 @@ def add_edge(
error_probability, has_error_probability)

def load_from_networkx(self, graph: nx.Graph) -> None:
"""
r"""
Load a matching graph from a NetworkX graph
Parameters
----------
graph : networkx.Graph
If `G` has `M` nodes, each node
`m` in `G` should be an integer :math:`0<m<M-1`, and each node should
be unique. Each edge in the NetworkX graph can have optional
attributes `qubit_id`, `weight` and `error_probability`.
`qubit_id` should be an int or a set of ints.
Note that the `qubit_id` attribute can instead be used to store the indices
of logical observables flipped by an error on the corresponding edge
(e.g. a frame change in an error instruction in a stim detector error model).
Each `weight` attribute should be a non-negative float. If
every edge is assigned an error_probability between zero and one,
then the `add_noise` method can be used to simulate noise and
flip edges independently in the graph.
Examples
--------
>>> import pymatching
Expand Down

0 comments on commit dc736a3

Please sign in to comment.