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.2.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 | Actions |
|---|---|---|---|---|
| pyforcedirectedlayout-2.2.0.tar.gz | 27.0 kB | With provenance | Details for pyforcedirectedlayout-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyforcedirectedlayout-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for pyforcedirectedlayout-2.2.0-py3-none-any.whl |
Total release size: 56.6 kB
Release files / pyforcedirectedlayout-2.2.0.tar.gz
| Download URL | pyforcedirectedlayout-2.2.0.tar.gz |
|---|---|
| Size | 27.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ab44450078613b590626d05b84c02712685901c024520a440f6e18c57de961f
|
|
BLAKE2b-256 checksum How to use checksums |
9fcac37b2ec65ae09cea9cad6f274a1a4dc5249d03d368a441b2bbde21e2e0c6
|
| 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 27, 2026.
Transparency logRelease files / pyforcedirectedlayout-2.2.0-py3-none-any.whl
| Download URL | pyforcedirectedlayout-2.2.0-py3-none-any.whl |
|---|---|
| Size | 29.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05d07002fc6941ce8b33e9555e3f15f84179ac4fc2c4474724614612386ab6fa
|
|
BLAKE2b-256 checksum How to use checksums |
3d68b93b1dae99626975184cbdfc60a864d0d48aaa129be9655045bd3c829630
|
| 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 27, 2026.
Transparency logSecurity for pyforcedirectedlayout 2.2.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyforcedirectedlayout-2.2.0.tar.gz
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 27, 2026.
Transparency logA 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.