Skip to content

Releases: AminAlam/fa2_modified

Version 0.4

27 Oct 12:14

Choose a tag to compare

Release Notes - fa2_modified v0.4

Overview

This release implements the overlap prevention feature (adjustSizes parameter) with full backward compatibility. The feature introduces anti-collision algorithms for node layout, preventing visual overlap in dense graphs while maintaining the existing API for users who don't require this functionality.

New Features

Overlap Prevention (adjustSizes)

Implemented size-aware collision detection and prevention for graph node layouts. The feature uses modified repulsion and attraction forces that account for node sizes, preventing overlap while maintaining graph structure integrity.

Implementation details:

  • Anti-collision repulsion applies 100x force multiplier for overlapping nodes
  • Anti-collision attraction prevents connected nodes from collapsing
  • Movement limiting constrains displacement for nodes when enabled
  • Configurable node sizes via nodeSize parameter

ForceAtlas2 Class

New parameters:

  • adjustSizes (bool, default=False): Enable overlap prevention
  • nodeSize (float, default=1.0): Node radius for collision detection

fa2util Module

Modified function signatures:
All force calculation functions now accept optional adjustSizes parameter (default=False):

  • linRepulsion(n1, n2, coefficient, adjustSizes=False)
  • apply_repulsion(nodes, coefficient, adjustSizes=False)
  • apply_attraction(nodes, edges, distributedAttraction, coefficient, edgeWeightInfluence, adjustSizes=False)
  • Region.applyForce(n, theta, coefficient, adjustSizes=False)
  • adjustSpeedAndApplyForces(nodes, speed, speedEfficiency, jitterTolerance, adjustSizes=False)

New functions:

  • linRepulsion_antiCollision(n1, n2, coefficient): Size-aware repulsion implementation
  • linAttraction_antiCollision(n1, n2, e, distributedAttraction, coefficient): Size-aware attraction implementation

Technical Improvements

Cython Compatibility

  • Changed function declarations from cdef to cpdef for Python accessibility when Cython-compiled
  • Updated .pxd type definitions to match .py implementation
  • Maintained optimization benefits while ensuring CI/CD compatibility

Backward Compatibility

  • All new parameters have sensible defaults preserving existing behavior
  • No changes required for existing codebases
  • Zero performance overhead when feature is disabled

Barnes-Hut Integration

  • Overlap prevention fully compatible with Barnes-Hut approximation
  • Region-based force calculations properly handle adjustSizes parameter
  • No degradation of Barnes-Hut optimization benefits

Testing

Test Coverage

Added comprehensive test suite (test_adjustSizes.py) with 22 test cases:

  • Unit tests for anti-collision functions (repulsion, attraction)
  • Integration tests with apply_repulsion and apply_attraction
  • Barnes-Hut region calculations with overlap prevention
  • Speed adjustment and movement limiting verification
  • Full layout computation tests
  • Backward compatibility verification

Bug Fixes

  • Resolved Cython compilation failures in CI/CD pipeline
  • Fixed function accessibility issues when code is Cython-compiled
  • Corrected test assertions for implemented vs. unimplemented features
  • Updated .pxd file to match implementation changes

Performance Characteristics

Default behavior (adjustSizes=False):

  • No performance impact
  • Identical behavior to previous versions

With overlap prevention (adjustSizes=True):

  • Computational overhead: 5-10% per iteration
  • Better visual results for dense graphs
  • Improved convergence stability through movement limiting

Migration Guide

For New Users

Enable overlap prevention by adding two parameters:

fa2 = ForceAtlas2(
    adjustSizes=True,
    nodeSize=2.0,
    # existing parameters...
)

For Existing Users

No changes required. Default behavior is unchanged. Feature is opt-in.

Acknowledgments

Version 0.3.10

30 May 09:13

Choose a tag to compare

Version 0.3.9

16 Apr 20:47

Choose a tag to compare

Cython working

Version 0.3.8

16 Apr 17:52
163813f

Choose a tag to compare

fa2util.c is added as a package data to setup.py to ensure Cython usage for this package

Version 0.3.7

16 Apr 17:49
cecbead

Choose a tag to compare

fa2util.c is added as a package data to setup.py to ensure Cython usage for this package

Version 0.3.6

16 Apr 17:33
b90c6c2

Choose a tag to compare

V0.3.6

Update python-publish.yml

Version 0.0.1

15 Mar 10:42
f557c3c

Choose a tag to compare

As the original repository is not maintained, I have fixed some of the bugs in this release. This pull request contains the changes.