|
@@ -15,25 +15,25 @@ Arbitrary 3D structures can be constructed by rotating the grid. |
|
|
The URL contains a unique ID such as `oranges-arkansas-mexico-fish`. You can share this URL with other people to share your screen and edit collaboratively. |
|
|
The URL contains a unique ID such as `oranges-arkansas-mexico-fish`. You can share this URL with other people to share your screen and edit collaboratively. |
|
|
|
|
|
|
|
|
## Python package |
|
|
## Python package |
|
|
The underlying graph state simulator is based on Anders' and Briegel's method. Full docs for the Python package are [here](https://peteshadbolt.co.uk/static/abp/). |
|
|
|
|
|
|
|
|
The underlying graph state simulator is based on Anders' and Briegel's method. Full docs for the Python package are [here](https://peteshadbolt.co.uk/static/abp/). You can install it like this: |
|
|
|
|
|
|
|
|
|
|
|
:::bash |
|
|
|
|
|
pip install abp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## API |
|
|
## API |
|
|
|
|
|
|
|
|
Here's a complete example of sending a state from Python to the server: |
|
|
Here's a complete example of sending a state from Python to the server: |
|
|
|
|
|
|
|
|
:::python |
|
|
:::python |
|
|
import requests, json, abp |
|
|
|
|
|
|
|
|
import abp |
|
|
|
|
|
|
|
|
# Make a new graph and position the nodes |
|
|
|
|
|
|
|
|
# Make a new graph and automatically position the nodes |
|
|
g = abp.NXGraphState(range(10)) |
|
|
g = abp.NXGraphState(range(10)) |
|
|
g.layout() |
|
|
g.layout() |
|
|
|
|
|
|
|
|
# Serialize |
|
|
|
|
|
data = json.dumps(test_graph().to_json()) |
|
|
|
|
|
|
|
|
|
|
|
# Post to the server |
|
|
# Post to the server |
|
|
URL = "https://abv.peteshadbolt.co.uk/oranges-arkansas-mexico-fish" |
|
|
|
|
|
requests.post("{}/graph".format(URL), data=data) |
|
|
|
|
|
|
|
|
g.push() |
|
|
|
|
|
|
|
|
### Endpoints |
|
|
### Endpoints |
|
|
|
|
|
|
|
|