Python Implementation of a Force Directed Layout Algorithm
Project description
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 (C) 2024
I am concerned about GitHub's Copilot project.
I urge you to read about the Give up GitHub campaign from the Software Freedom Conservancy.
While I do not advocate for all the issues listed there, I do not like that a company like Microsoft may profit from open source projects.
I continue to use GitHub because it offers the services I need for free. But I continue to monitor their terms of service.
Any use of this project's code by GitHub Copilot, past or present, is done without my permission. I do not consent to GitHub's use of this project's code in Copilot.
Project details
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
File details
Details for the file pyforcedirectedlayout-0.80.5.tar.gz
.
File metadata
- Download URL: pyforcedirectedlayout-0.80.5.tar.gz
- Upload date:
- Size: 25.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd59dbe3dbf120765666e1ed4ac26f78fd93fb2e7fc86174ac2ad5451793d1b3 |
|
MD5 | 9353db8811cae402a73e9efcb1fa7157 |
|
BLAKE2b-256 | ae0639a2acbf3fe63baa5567f887f281a64e9d687856f6f7822f984071f299ac |
File details
Details for the file pyforcedirectedlayout-0.80.5-py3-none-any.whl
.
File metadata
- Download URL: pyforcedirectedlayout-0.80.5-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 958c88730f18460a4a179ecf7b7d3b12913a3bfc96a168b46bddf6d8d297e4a5 |
|
MD5 | 09a47d6aff3f2e9cdc598e15ecae426c |
|
BLAKE2b-256 | 89438cba378c17572cbd921c9778be0ccb5ca337b8fd3389f8b0029e9be1ac19 |