Small Graph Lib
Installing
Basic installation
Smallgraphlib is on PyPI, so you can download and install it with pip, as any usual python package.
pip install smallgraphlib
Development version
For development, please clone the last version from Github:
git clone https://github.com/wxgeo/smallgraphlib
You will then need uv to manage the development process.
If needed, install it on Linux or Mac with:
curl -LsSf https://astral.sh/uv/install.sh | sh
More information on uv installation
It is also recommended to install just command runner, to execute
the recipes of the justfile.
uv tool install rust-just
Usage
Main classes are Graph, DirectedGraph, WeightedGraph and WeightedDirectedGraph:
>>> from smallgraphlib import DirectedGraph
>>> g = DirectedGraph(["A", "B", "C"], ("A", "B"), ("B", "A"), ("B", "C"))
>>> g.is_simple
True
>>> g.is_complete
False
>>> g.is_directed
True
>>> g.adjacency_matrix
[[0, 1, 0], [1, 0, 1], [0, 0, 0]]
>>> g.degree
3
>>> g.order
3
>>> g.is_eulerian
False
>>> g.is_semi_eulerian
True
Special graphs may be generated using factory functions:
>>> from smallgraphlib import complete_graph, complete_bipartite_graph
>>> K5 = complete_graph(5)
>>> len(K5.greedy_coloring)
5
>>> K33 = complete_bipartite_graph(3, 3)
>>> K33.degree
6
>>> K33.diameter
2
If the graph is not too complex, Tikz code may be generated:
>>> g.as_tikz()
...
Development
-
Install dependencies including development tools:
uv sync
- Optionally, update dependencies and development tools:
uv sync --upgrade
- Optionally, install library in editable mode:
uv pip install -e smallgraphlib
-
Make changes, add tests.
-
Launch tests:
just test
- Everything OK? Commit. :)
Metadata
Release files for smallgraphlib 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| smallgraphlib-1.4.0.tar.gz | 44.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smallgraphlib-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 96.2 kB
Release files / smallgraphlib-1.4.0.tar.gz
| Download URL | smallgraphlib-1.4.0.tar.gz |
|---|---|
| Size | 44.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6980f9c18ef1a6aad155aace851c1e059c72c8f0b70e7b952c41282b3e3d6f7a
|
|
BLAKE2b-256 checksum How to use checksums |
d33a87495d06dc3d320ddaf3d5a71639d2ea3e84f35cac52225cc66d6154efd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / smallgraphlib-1.4.0-py3-none-any.whl
| Download URL | smallgraphlib-1.4.0-py3-none-any.whl |
|---|---|
| Size | 52.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20509e3c1ac99d37366434c0231b8b553b747c48e029fb9eb0d9c1313a6cca66
|
|
BLAKE2b-256 checksum How to use checksums |
b09a955dc148ce4a6f8fd4060589da5cc7075868df99d00a368bd1ba3d0bc103
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for smallgraphlib 1.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.