Repository navigation
projective polarity graph generator - #8066
sean-chernov wants to merge 15 commits into
Conversation
|
This looks like a new graph generator of networkx that are at least close to some used in router network topology design. It is dependent on an extension package of NumPy to finite fields called I wonder if the name There are a number of bookkeepping tasks to make this work smoothly with NetworkX. If that is too daunting we can probably morph this into a PR that passes tests. Or we can help you do it.
I'm not sure about the Finally for now, what got you into this kind of work? What problems is this useful for? What motivated you to code it up and submit it to NetworkX? Thanks! |
|
Hi, thank you for the detailed feedback and the thoughtful review. My partner (Shai Reuven) and I are electrical engineering students working on our final bachelor's project in the NSSL (Networked Software Systems Lab). The focus of our project is implementing and evaluating graph constructions relevant to network topology design, particularly those that are not yet available in NetworkX. Specifically, we’re contributing implementations for three graph models: Xpander via k-lift, ER polarity graphs (used in PolarFly), and SlimFly. This PR and the earlier k-lift one are our first contributions.
However, upon reading further, we noted that the paper explicitly states the construction is valid for prime powers (i.e., q = p^k). In those cases, the field GF(q) becomes a finite field extension, and arithmetic involves polynomials modulo an irreducible polynomial over GF(p). These operations are mathematically more complex and aren't feasible to handle correctly using just NumPy’s mod functionality. That’s what motivated the use of the galois library: it provides a clean and efficient interface for handling arithmetic in extended finite fields without manually managing polynomial arithmetic. We understand this introduces an external dependency and would be happy to help refactor the code to isolate that dependency as needed.
We’re happy to revise the name if there’s a more standardized or widely recognized term for this class of graphs. One alternative could be “projective_orthogonal_graph”, or grouping it under a broader category like finite_geometry.py if there are future related contributions. Thanks for outlining the integration requirements clearly. We'll follow the steps you suggested. |
rossbar
left a comment
There was a problem hiding this comment.
IMO the galois dependency is a hard blocker, especially since galois itself looks like it depends on numba.
Have you considered publishing a separate package? That would probably be the easiest way to get this code out there without having to worry about dependencies!
|
Thanks for the feedback. I’ll definitely consider publishing the more general Galois-based version as a separate package. In the meantime, would you be interested in me updating this pull request to use a simplified version of the code that only supports prime values of q? This version avoids the galois dependency entirely and uses a standard modular dot product. It covers many practical use cases and follows the form shown in typical examples (like those in the PolarFly paper), though with the limitation that q must be a prime number. |
rossbar
left a comment
There was a problem hiding this comment.
In the meantime, would you be interested in me updating this pull request to use a simplified version of the code that only supports prime values of q?
It would be interesting to me personally, but I'm not at all familiar with the subdomain so I have no sense at all whether or not this is a good fit for networkx! The only thing I can say definitively is that galois is a hard-blocker for me!
|
updated the PR to use a simplified version with no Galois dependency |
|
Updated this PR to pass all checks. The main issues were: |
|
Hi! Just wanted to check in. Are there any further changes you'd like me to make (aside from the final placement), or at this point is it more a question of whether the PR fit within NetworkX? Happy to adjust if needed! |
|
Hello, For the sake of accuracy, I am changing the name of this PR (and its main function) to "Projective Polarity Graph generator". This is to avoid confusion, since "ER polarity graph" refers specifically to polarity graphs based on PG(2, q), which approach the Moore bound. |
changed the main function and file names. Improved the doc string and the code
|
Hello, For this PR, I plan to make the following adjustments: |
-remove m=1 case and connectivity raise. add instead raise for m<2 (or non integer) -update docstring and refernces
-merge structure tests -diameter 2 test only for m=2 case (ER polarity) -add test for invalid m value
|
Hello, now that the random k-lift PR has been successfully merged, we’re ready to focus on the remaining low-diameter topology PRs: #8066 and #8118 (Slim Fly ring). Do you have any outstanding questions or concerns about either of these PRs? Also, would you prefer that we keep them as separate PRs, or would it make sense to consolidate them (for example, under a shared low-diameter module)? |
|
Hello, any updates on wheter you think those PRs fit the library and which direction you want to take with them? |
This PR adds a new module for generating polarity graphs based on the finite projective space PG(m, q) over GF(q) including the ER polarity graph based on PG(2, q). These graphs are known for their low diameter (2 for ER polarity), near-regularity, and strong connectivity while ER is also useful for modeling deterministic low-diameter network topologies such as PolarFly.