Skip to main content

Python Implementation of a Force Directed Layout Algorithm

Project description

Maintenance CircleCI PyPI version

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

Humberto's Modified Logo

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

pyforcedirectedlayout-1.0.0.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyforcedirectedlayout-1.0.0-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file pyforcedirectedlayout-1.0.0.tar.gz.

File metadata

  • Download URL: pyforcedirectedlayout-1.0.0.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyforcedirectedlayout-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d7ad2c3f47ff80533663e8359571f33657b3bbecf60d0c1a0f396918ddeed855
MD5 4e8ad0908e48efa30daaba7b42113feb
BLAKE2b-256 e8a52d144aa7179344e1a48e2044807c5862a930ef37659fc91726236e601cbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyforcedirectedlayout-1.0.0.tar.gz:

Publisher: python-publish.yml on hasii2011/py-force-directed-layout

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyforcedirectedlayout-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyforcedirectedlayout-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 934303e3153312647a025db71ac8779d5915f5a35c44152921c2e9344a526b06
MD5 4a96c26d2260829be6a3e412dd612862
BLAKE2b-256 168b93fb21e72685891f0f25a76c394d1fc28ac566f7997e10048f903b48a558

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyforcedirectedlayout-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on hasii2011/py-force-directed-layout

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page