A library for network visualization and algorithm simulation.
Project description
AlgorithmX Python
AlgorithmX Python is a library for network visualization and algorithm simulation, built on AlgorithmX. It works through either a WebSocket server, or as a widget in Jupyter Notebooks and JupyterLab.
Resources
Installation
Python 3.6 or higher is required.
AlgorithmX can be installed using pip:
pip install algorithmx
Jupyter Widget
In classic Jupyter notebooks, the widget will typically be enabled by default. However, if you installed using pip with notebook version <5.3, you will have to manually enable it by running:
jupyter nbextension enable --sys-prefix --py algorithmx
with the appropriate flag. To enable in JupyterLab, run:
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install algorithmx-jupyter
Example Usage
If you wish to use the library through a HTTP/WebSocket server, follow the template below:
import algorithmx
server = algorithmx.http_server(port=5050)
canvas = server.canvas()
def start():
canvas.nodes([1, 2]).add()
canvas.edge((1, 2)).add()
canvas.listen('start', start)
server.start()
Be default, the output can be found at http://localhost:5050/.
If you are using Jupyter, add the following to a cell:
import algorithmx
canvas = algorithmx.jupyter_canvas()
canvas.nodes([1, 2]).add()
canvas.edge((1, 2)).add()
display(canvas)
Development
Install
If you aren't using docker, you can install the package locally:
cd js
npm run build
npm run inject
cd ..
pip install --no-deps --editable .
Run HTTP Server
With docker:
docker-compose up http-server
Manually:
python -u examples/basic_http_server.py
Then, in both cases, open localhost:5050 in a browser.
Run Notebook
With docker:
docker-compose up notebook
You will need to follow the link which appears in the output.
Manually:
jupyter nbextension install --symlink --sys-prefix --py algorithmx
jupyter nbextension enable --sys-prefix --py algorithmx
jupyter notebook
Then, in both cases, navigate to examples/basic.ipynb.
Build package
rm -rf build dist
With docker:
docker-compose up build
Manually:
python setup.py build sdist bdist_wheel
In both cases, the bundle can be found in dist/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file algorithmx-1.1.3.tar.gz.
File metadata
- Download URL: algorithmx-1.1.3.tar.gz
- Upload date:
- Size: 2.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd05069663e07ea08394dec16f81d855703e102aee3dc82c247142c554c06271
|
|
| MD5 |
ce3ec008c7f3de4849f295f455bd1d90
|
|
| BLAKE2b-256 |
25fd364060b3a30a4380210d40cfae56664d5717a6e3e5b02cb11616ee206e6d
|
File details
Details for the file algorithmx-1.1.3-py3-none-any.whl.
File metadata
- Download URL: algorithmx-1.1.3-py3-none-any.whl
- Upload date:
- Size: 5.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54e35ded887cc45f1339e009070b030b903aea58dfd7b7aedb8450c59e35c083
|
|
| MD5 |
f848e9c9ea2cab8feed0300ee2187979
|
|
| BLAKE2b-256 |
0e5461fb5dc6fe25eb6ad39c5641f92fd0a8eb3b2455e2549af2ee90ab697521
|