-
Notifications
You must be signed in to change notification settings - Fork 260
feat: expose voronoi to python #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: expose voronoi to python #833
Conversation
Try to avoid re-formatting the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a few comments, not an exhaustive review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a full review yet, I haven't checked the unit test and the Python side in detail. From a bird's eye view the Python side looks good.
I think |
Co-authored-by: Szabolcs Horvát <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the Voronoi‐based community detection algorithm to the Python igraph API, providing both C and Python bindings and adding basic tests to validate its behavior.
- Expose
community_voronoi
in the C library and register it inGraph
- Add a Python wrapper
_community_voronoi
incommunity.py
- Add
testVoronoi
unit tests for simple graph scenarios
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/test_decomposition.py | New testVoronoi method with three basic cases |
src/igraph/community.py | Added _community_voronoi Python wrapper |
src/igraph/init.py | Registered community_voronoi in Graph |
src/_igraph/graphobject.c | Implemented igraphmodule_Graph_community_voronoi |
Comments suppressed due to low confidence (2)
src/igraph/community.py:372
- The docstring for
mode
does not mention thetotal
alias that is supported inmode_map
. Update the parameter description to include"total"
as an alias for"all"
.
mode_map = {"out": "out", "in": "in", "all": "all", "total": "all"} # alias
tests/test_decomposition.py:538
- [nitpick] The tests only cover the default parameters. Consider adding cases for non‐unit
lengths
, non‐unitweights
, non‐defaultmode
, and a customradius
to fully exercise the new API.
def testVoronoi(self):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all your work on this so far @BeaMarton13 !
There are some warnings when building docs. Can you help me by investigating the cause?
WARNING: /Users/szhorvat/Repos/python-igraph/.venv/lib/python3.13/site-packages/igraph/_igraph.abi3.so:???: Cannot parse signature of igraph._igraph.GraphBase.community_voronoi
WARNING: /Users/szhorvat/Repos/python-igraph/.venv/lib/python3.13/site-packages/igraph/community.py:333: Cannot find link target for "igraph.Graph.ecc"
WARNING: /Users/szhorvat/Repos/python-igraph/.venv/lib/python3.13/site-packages/igraph/_igraph.abi3.so:???: Documented parameter "lengths" does not exist
WARNING: /Users/szhorvat/Repos/python-igraph/.venv/lib/python3.13/site-packages/igraph/_igraph.abi3.so:???: Documented parameter "weights" does not exist
WARNING: /Users/szhorvat/Repos/python-igraph/.venv/lib/python3.13/site-packages/igraph/_igraph.abi3.so:???: Documented parameter "mode" does not exist
WARNING: /Users/szhorvat/Repos/python-igraph/.venv/lib/python3.13/site-packages/igraph/_igraph.abi3.so:???: Documented parameter "radius" does not exist
WARNING: /Users/szhorvat/Repos/python-igraph/.venv/lib/python3.13/site-packages/igraph/__init__.py:3993: Cannot find link target for "igraph.Graph.ecc"
…ython-igraph into feat/expose_voronoi_python
@BeaMarton13, I just fixed this, please see the last commit (7c30c6c). It's something very easy to miss. |
@ntamas I believe this is ready. Please have a look and merge. Please use only squash-and-merge as the commit history is a mess! |
Thanks! |
I used Cody for the functions.