Skip to content

Commit

Permalink
slight rephrase
Browse files Browse the repository at this point in the history
  • Loading branch information
akissinger committed Oct 7, 2020
1 parent a9a2624 commit 7612e44
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion misc/graph_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ d0 -> y0 : b 0
d1 -> y1 : b 2
```

Every vertex needs a coordinate, which in PyZX consists of a row and qubit index. The `row` is kept implicitly as a global variable, where initially `row := 1`. When a `===` is encountered, the value of `row` is set to the next integer value `row := floor(row + 1)`. Optionally, an amount to increment the row can be provided, which is allowed to be a non-integer, in which case `=== r` sets `row := row + r`.
Every vertex needs a coordinate, which in PyZX consists of a row and qubit index. The `row` is kept implicitly as a global variable, where initially `row := 1`. When a `===` is encountered, the value of `row` is incremented.

Vertices are declared by giving them a name, followed by a colon then a type, qubit index, and optional phase, given as a rational multiple of pi. For example: `a : z 1 1/2` places a `Z` vertex on the current row, at qubit 1, with phase pi/2.

Expand All @@ -49,6 +49,9 @@ Once all vertices in an edge expression are declared, it doesn't matter when the

Boundary vertices appearing on the first row are assumed to be inputs, and boundaries on last row are assumed to be outputs.

Optionally, the row separator can be provided with a (possibly non-integer) number to skip some space or place vertices between rows, in which case `=== r` sets `row := row + r`. To account for non-integers, the default `===` operation actually sets `row := floor(row + 1)`.


## Grammar

Here's the full grammar, where `id` means a string of identifier characters, i.e. alphanumeric, plus dash and underscore. Note ?, *, and + have their usual regex meaning.
Expand Down

0 comments on commit 7612e44

Please sign in to comment.