A reliable idiomatic wrapper for networkx [$400]
A reliable idiomatic networkx wrapper [$400]
Using networkx through PythonCall.jl is trivially easy. This bounty is mostly about creating a new NetworkX.jl wrapper (by using PythonCall.jl) that provides quality-of-life improvements,
- [ ] Fast conversion and/or views between Graphs.jl types and the networkx structures
- [ ] Complete Graph API support for the newly created networkx wrapper types (so that networkx types can be used in all already existing Graph.jl algorithms that do not peek behind the API)
- [ ] use GraphsInterfaceChecker.jl in the test suite
- [ ] Dispatch from operations defined in Graphs/GraphsMatching/GraphsOptim to networkx implementation. For instance if there is a pre-existing
Graphs.some_interesting_property(::AbstractGraph)there should now be a new method defined in NetworkXsome_interesting_property(g::AbstractGraph, ::NXAlgorithm)that dispatches to the networkx implementation. It should convert thegargument to networkx graphs if necessary. - [ ] If there is an algorithm defined in networkx that does not exist yet in Graphs.jl, it should be declared in Graphs.jl (just a function with docs but no methods), together with an error hint that NetworkX is necessary. Given the large scope of the library, this can be more of a proof-of-concept setup, documenting how to add everything, but not expecting everything to be added for completing the bounty.
- [ ] Proper tests and documentation.
- [ ] PRs on this topic have to be submitted with clean git histories and well compartmentalized for ease of review.
Required skills: familiarity with the Graphs.jl API and understanding of the PythonCall package
Reviewer: any Graphs.jl member with merge rights
Duration: 3 months
Payout procedure:
The Funding for these bounties comes from the National Science Foundation and from the NSF Center for Quantum Networks. The payouts are managed by the NumFOCUS foundation and processed in bulk once every two months. If you live in a country in which NumFOCUS can make payments, you can participate in this bounty program.
Click here for more details about the bug bounty program.
Bug bounty logistic details (click to expand)
To claim exclusive time to work on this bounty either post a comment here or message [email protected] with:
- your name
- github username
- (optional) a brief list of previous pertinent projects you have engaged in
If you want to, you can work on this project without making a claim, however claims are encouraged to give you and other contributors peace of mind. Whoever has made a claim takes precedence when solutions are considered.
You can always propose your own funded project, if you would like to contribute something of value that is not yet covered by an official bounty.
Hey @Krastanov, I have contributed to SymPy, SunPy, and other computational science packages. I am excited to work on this NetworkX.jl wrapper implementation.
I have extensive experience with
- Julia’s
Graphs.jlecosystem and the AbstractGraph interface - Python’s
NetworkXlibrary and graph algorithm implementations -
PythonCall.jlfor seamless Julia Python interoperability - Graph data structure conversions and performance optimization
I would like to take on this bounty challenge and deliver a high quality well tested wrapper that enables fast conversions and complete API coverage. Let me know if you would like to see my detailed implementation plan.
Hey @Krastanov ,
I'm interested in taking this up. The main reason is that I've coded extensively in Python for past 8 years and my work mostly deals with graph library, and arguably, NetworkX.py has most extensive methods implemented, that's why I often use NetworkX.py to do prototype. Well, not surprisingly, I was struggling with the long runtime when working on large-scale graphs.
This is the exact reason which brings me into Graphs.jl. I wanted to say thanks you so much for building such high performance graph library, and keep maintaining it. For this project, I did see the value of using wrapper to consume the extensive methods available from NetworkX. It also opens many gates for future refactoring / Julia-native implementation of these methods.
Let's talk a bit about my background. As for Julia, I has just joined this loving community for about 6 months, and happy to get my very first Julia CR accepted in Graphs.jl. I won't claim myself as expert, but I do have the confidence to get this job done.
I'd hope to take this as a chance to better understand the interactions between Julia and Python, and this is the major (sole) motivation for me to do this bounty.
Thanks folks for expressing interest in the bounty! Just a quick correction: while I do some minor maintenance work here, this library was built by others (mostly simonschoelly and gdalle in the last few years, and other significant contributors earlier on)
Let's start with assigning this to @iamrajiv simply because they expressed interest first. However, given that there are multiple volunteers that want to engage with this, I would ask you @iamrajiv to be a bit more proactive in showing progress -- e.g. by submitting a rough plan in the next few days and some initial prototype withing a couple of weeks. This is of course mostly volunteer work so it would be inappropriate of me to make significant demands (the bounty is pretty small for the actual contribution given back to the community), but I have to put in some work to protect the ecosystem from spam submissions generated with an LLM. In particular, I have had to cancel bounties in the last few months when it turns out that a contributor has misrepresented their knowledge of Julia, e.g. by proposing a nonsensical initial plan or by not knowing how to set up a simple empty package. I never assume this at the start, but it is something I have to proactively guard against, hence this long list of caveats and warnings here.
@Syuizen , I would be eager to help onboard you on any of the other bounties or to increase the total award for this bounty so that it can be split with @iamrajiv (after we hear his initial plan and deciding how the work can be split).
Both of you, feel free to message me at [email protected] if you want more privacy in how you discuss your plans.
Hi, @iamrajiv ! Could you confirm you are looking into this bounty? Please let us know how you want to proceed with the bounty, etc. Check out the questions and suggestions from the previous comment.
The bounty is open again as iamrajiv did not respond whether they want to engage with the bounty. @Syuizen are you interesting in pursuing it?
@Krastanov Yes! definitely interested. May I know how I could better start on this project?
I would suggest first setting up a package that uses PythonCall to import networkx of a particular version. Check out PyQDecoders.jl for a simple example. Then set up a struct that wraps around the networkx struct and follows the Graphs.jl API as verified by GraphInterfaceChecker. Check out NautyGraphs.jl for an example of such set of tests. From there we can build out the rest relatively easily. Check out the Graphs.jl repository for how to structure the CI (in .github).
You should also have constructors Graph(::NetworkXGraph) and NetworkXGraph(::Graph).
Sounds good! I have never done CI before, and using PythonCall is also new to me.
My plan is to start with a new repo to have the two constructors implemented as you mentioned. Then I will add CI.
ETA will be 1 week for the new repo + 2 constructors and another week for CI.
@Syuizen , how is this going? Is there anything I can help with?
Hi @Krastanov , all good. Sorry for being silent for a while. Was busy with a conference travel. I should share the repo by end of this week.
@Krastanov I keep my updates on a toy repo first GraphsNxExample.jl
I'm exploring the most efficient way of converting networkX graphs back into Graphs.jl. It was a surprise to me that using sparse matrix is not faster than simply loop over all edges.
I will continue working on that repo and keep posts here whenever I have updates. In the meantime, please let me know if you (or anyone reading this thread) have any comments!
Thanks for the heads up! A few misc comments:
- setting it up as a package can help with a lot of chores (although that setup is itself a chore). Check out VNGraphs/LemonGraphs/IGraphs for an example package structure or just use PackageTemplates. In particular, bringing over the .github folder and test folder can speed up a lot of your work
- depending on exactly how the sparse matrix is stored, it might be less efficient for representing a graph -- there is a great variety in how this can be set up
- check out PyQDecoders for a simple example of how to import python packages in a julia library -- the import might interact weirdly with pre-compilation, so it can be a pain to set it up properly
- you can go ahead and use a more final name -- name changes are easy before the package gets registered