Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jorgens
Copy link

@jorgens jorgens commented Jan 29, 2026

Summary

Enables 3D coordinate support for MaxentStress warm start in Python interface.

Changes

  • viz.pyx: Updated MaxentStress to accept both 2D and 3D initial coordinates
  • test_viz.py: Added comprehensive test suite for warm start functionality

Motivation

Previously, MaxentStress could only accept 2D initial coordinates from Python, even though the C++ implementation supports 3D. This blocked users from warm starting 3D layout algorithms.

Backward Compatibility

✅ Fully backward compatible - existing 2D code works unchanged

Testing

  • All new tests pass
  • Existing tests remain passing
  • Tested both 2D and 3D warm start scenarios

Full Disclosure

I heavily relied on Claude (AI) to do this change since I am not familiar with Cython at all.

- Updated MaxentStress to accept 3D initial coordinates via Python
- Changed coordinates parameter from vector<pair<double,double>> to vector<vector<double>>
- Added unit tests for 2D/3D warm start
- Updated documentation to clarify warm start behavior
- Maintains backward compatibility with existing 2D code
@coveralls
Copy link

coveralls commented Jan 29, 2026

Pull Request Test Coverage Report for Build 21520642997

Details

  • 11 of 11 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 79.474%

Totals Coverage Status
Change from base Build 21438191500: 0.04%
Covered Lines: 29531
Relevant Lines: 37158

💛 - Coveralls

@fabratu
Copy link
Member

fabratu commented Jan 30, 2026

Thanks for your contribution - good idea.

One of the new lines is not covered by tests, specifically raise ValueError(f"Coordinates must be 2D or 3D, got {coord.size()} dimensions").

Please add a test using different dimensions, checking for throw. This should cover the line of interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants