Introduction
This project is the Python implementation of Brad Smith's article on A Forced-Directed Diagram Layout Algorithm. There were a few bumps on the road to get Brad's code manually converted from a Microsoft graphics platform to a pseudo-platform independent platform like wxPython running on Mac OS. I will not go into detail on what those bumps were. But I want to make sure and document those here.
Details
Install in your virtual environment
pip install pyforcedirectedlayout
Configuration details
These drive the algorithm
| Parameter | Default Value | Description |
|---|---|---|
| damping | 0.1 | Value between 0 and 1 that slows the motion of the nodes during layout. |
| springLength | 100 | Value in pixels representing the length of the imaginary springs that run along the connectors. |
| maxIterations | 500 | Maximum number of iterations before the algorithm terminates |
| attractionForce | 0.1 | The spring value |
| repulsionForce | 10000 | The repulsion value |
Randomize the layout
| Parameter | Default Value | Description |
|---|---|---|
| minPoint | Point(x=10, y=10) | |
| maxPoint | Point(x=60, y=60) |
Early Termination
| Parameter | Default Value | Description |
|---|---|---|
| minimumTotalDisplacement | 10 | |
| stopCount | 15 | Stop execution after this many number of iterations where the totalDisplacement is less that minimumTotalDisplacement |
Developer Notes
This project uses buildlackey for day-to-day development builds
Note
For all kinds of problems, requests, enhancements, bug reports, etc., drop me an e-mail. Written by Humberto A. Sanchez II ©2026
Metadata
Release files for pyforcedirectedlayout 2.1.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 | |
|---|---|---|---|
| pyforcedirectedlayout-2.1.0.tar.gz | 26.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyforcedirectedlayout-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.3 kB
Release files / pyforcedirectedlayout-2.1.0.tar.gz
| Download URL | pyforcedirectedlayout-2.1.0.tar.gz |
|---|---|
| Size | 26.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
898cbcc10f82e940a08c87f0d4482bb29f8951e5b09442e3830e9293ff1f929e
|
|
BLAKE2b-256 checksum How to use checksums |
f4acae4b1f60e24b3f17ee6d27ecef995ec89242020f93a35dc8aec49fae7069
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / pyforcedirectedlayout-2.1.0-py3-none-any.whl
| Download URL | pyforcedirectedlayout-2.1.0-py3-none-any.whl |
|---|---|
| Size | 29.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01e3dcbe0f1a0f0f6c699aca2989a1c9c24b9c03971632d85a31336dd8fdef24
|
|
BLAKE2b-256 checksum How to use checksums |
9b7a27500dd22d2973b52a43176df772f3b99f65603bb37a2aadf08c59f99f6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency log