Graphs.jl icon indicating copy to clipboard operation
Graphs.jl copied to clipboard

A reliable idiomatic wrapper for the C library `igraphs` [$400]

Open Krastanov opened this issue 1 year ago • 17 comments

A reliable idiomatic igraphs wrapper [$400]

The JuliaGraphs/IGraphs.jl package already exists and provides a simple low-level wrapper for the igraph C library. A lot of this work probably will not be directly in the Graphs.jl repository.

  • [ ] Fast conversion and/or views between Graphs.jl types and the C structures of igraph (slow converters already exist for simple graphs and some vectors/matrices)
  • [ ] Complete Graph API support for the IGraph types (so that IGraph 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 igraph implementation. For instance if there is a pre-existing Graphs.some_interesting_property(::AbstractGraph) there should now be a new method defined in IGraphs some_interesting_property(g::AbstractGraph, ::IGraphAlgorithm) that dispatches to the C implementation. It should convert the g argument to IGraph if necessary.
  • [ ] If there is an algorithm defined in igraph 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 IGraphs 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 Julia-C interface

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.

Krastanov avatar Jul 24 '25 18:07 Krastanov

So the payout is not upon merge, once every two months?

BenraouaneSoufiane avatar Aug 01 '25 15:08 BenraouaneSoufiane

I want to participate, but I've still confused about the payout

BenraouaneSoufiane avatar Aug 01 '25 15:08 BenraouaneSoufiane

If the bounty is successfully completed, you will be awarded the amount. It will be paid out through the NumFOCUS foundation.

Krastanov avatar Aug 01 '25 16:08 Krastanov

There is no strict payout schedule -- usually they are paid out a few weeks after you submit an invoice to NumFOCUS (which can happen only after the bounty is completed, which might involve separate PRs and review cycles). It might take up to a month or two for the payout to be completed after the bounty is closed, due to various bureaucratic delays. You can look through the various closed bounties on the QuantumSavory and JuliaDynamics and qojulia github organizations to get a sense of past bounties that have been completed.

Krastanov avatar Aug 01 '25 16:08 Krastanov

There is no strict payout schedule -- usually they are paid out a few weeks after you submit an invoice to NumFOCUS (which can happen only after the bounty is completed, which might involve separate PRs and review cycles). It might take up to a month or two for the payout to be completed after the bounty is closed, due to various bureaucratic delays. You can look through the various closed bounties on the QuantumSavory and JuliaDynamics and qojulia github organizations to get a sense of past bounties that have been completed.

Thank you for your reply, I've some experience in C/python (compiled phi2 on tesntorrent hardware), also with graphs but litegraph.js (most recent PR that add new feature to comfyUI), I think I can achieve/close this issue if you can assign me

BenraouaneSoufiane avatar Aug 01 '25 16:08 BenraouaneSoufiane

If you have not had any past experience with Julia this issue would be much too difficult of a way to start working in this ecosystem. I would be happy to assign the bounty to you if you show one or two PRs in the ecosystem and I am happy to help you with setting that up (make sure you read the Julia manual and https://modernjuliaworkflows.org/), but that would be a prerequisite to assigning exclusive time to you for this bounty.

Krastanov avatar Aug 01 '25 17:08 Krastanov

If you have not had any past experience with Julia this issue would be much too difficult of a way to start working in this ecosystem. I would be happy to assign the bounty to you if you show one or two PRs in the ecosystem and I am happy to help you with setting that up (make sure you read the Julia manual and https://modernjuliaworkflows.org/), but that would be a prerequisite to assigning exclusive time to you for this bounty.

Ok, thank you.

BenraouaneSoufiane avatar Aug 01 '25 17:08 BenraouaneSoufiane

@Krastanov Hello again, I just submitted two PRs, which resolve this issue, I'm looking to here from you, thank you! https://github.com/JuliaGraphs/Graphs.jl/pull/456 https://github.com/JuliaGraphs/IGraphs.jl/pull/15

BenraouaneSoufiane avatar Aug 16 '25 10:08 BenraouaneSoufiane

Thanks, @BenraouaneSoufiane ! I left a few comments in these locations. There are some idioms that are a bit weird for Julia code, so we might need to do some minor restructuring, but at this point I am comfortable reserving this bounty for you, if you would like that. Please just let me know!

Krastanov avatar Aug 16 '25 12:08 Krastanov

@BenraouaneSoufiane , how is this going? Is there anything I can help with?

Krastanov avatar Sep 12 '25 03:09 Krastanov

@BenraouaneSoufiane , how is this going? Is there anything I can help with?

Hello, thank you for your attention, I were working on side issues, I try to deliver the two PRs today/tonight

BenraouaneSoufiane avatar Sep 12 '25 13:09 BenraouaneSoufiane

I will proceed with re-opening this bounty as the agent-assisted code being submitted has issues that I can not productively address it a code review of reasonable size. Do not hesitate to discuss any questions you might have -- happy to help with onboarding.

Krastanov avatar Sep 30 '25 02:09 Krastanov

Hi @Krastanov, I've submitted two PRs to IGraphs.jl addressing the bounty requirements:

PR 1: Complete Graphs.jl AbstractGraph API

  • Implements edges, outneighbors/inneighbors, add_edge!, add_vertex!, rem_vertex!, copy
  • Fixes a 0-indexing bug in has_edge
  • Adds GraphsInterfaceChecker.jl to the test suite (both mandatory and mutation interfaces pass)
  • 305 tests pass (up from 267)

PR 2: Add IGraphAlg dispatch for connectivity algorithms

  • Adds IGraphAlg dispatch for connected_components, is_connected, articulation, bridges
  • Output matches Graphs.jl conventions
  • All tested against reference implementations

Both PRs are self-contained with clean git histories as requested. Happy to iterate based on review feedback.

nenadilic84 avatar Feb 12 '26 20:02 nenadilic84

I understand the task is to create an idiomatic wrapper for the igraph C library within the Julia Graphs ecosystem, enabling seamless use of igraph algorithms via the Graphs.jl API. My delivery plan: 1) Develop fast conversion utilities between Graphs.jl types and igraph C structures, extending the Graph API for IGraph types. 2) Implement dispatch mechanisms from existing Graphs operations to igraph implementations and integrate GraphsInterfaceChecker.jl into the test suite. Please provide acceptance criteria to ensure the wrapper meets project standards.

zhanglin2603 avatar Feb 12 '26 20:02 zhanglin2603

Hi maintainers, I would like to take "A reliable idiomatic wrapper for the C library igraphs [$400]". I can start immediately and keep updates in-thread so progress is easy to track. First PR plan: reproduce the issue against acceptance criteria, ship a minimal fix, and include focused tests in the first PR. First PR deliverable: minimal-risk patch, clear commit scope, and verification notes. I will include test evidence and assumptions so maintainers can review quickly. You can reach me at [email protected]. Best, Jerry Li

lmee avatar Feb 12 '26 21:02 lmee

/attempt #446

nenadilic84 avatar Feb 13 '26 06:02 nenadilic84

Hi @Krastanov, I read this issue end-to-end (including the bounty logistics and PR review constraints).

I can take a small first slice and keep it reviewable:

  1. Graphs.jl -> IGraphs.jl conversion helpers + basic traversal coverage.
  2. Focused tests and docs for that slice.
  3. Small, cleanly-scoped PRs (not one large drop), as requested.

If this bounty is still open for new contributors, I’d like to claim a work window and share the first PR update in ~48 hours.

energypantry avatar Feb 16 '26 16:02 energypantry

Hi @Krastanov this issue and its pr is becoming stale , can we just round it up ?

mahmudsudo avatar Aug 02 '26 15:08 mahmudsudo

Not a claim, just a heads up that I put one concrete fix up as JuliaGraphs/IGraphs.jl#55, since it is a bug rather than a design question. Graphs.has_edge hands one-based vertices to the zero-based get_eid, so on path_graph(4) it raises IGraphException for the real edge 3 to 4, and has_edge(g, 0, 1) returns true for a vertex that does not exist. The current suite does not see it because the answer is accidentally right whenever the two vertices are consecutive, which is every pair in a path graph and in the random regular graphs used in test_consistency.jl.

Worth flagging for anyone else working here: the jet=true lane is red on every pull request in the repository right now, the dependabot ones included, because test/test_jet.jl passes target_defined_modules = true and current JET rejects that option while constructing the analyzer, before any package code is read. It is a one line change, and @Krastanov asked for the same update on IGraphs.jl#43 in March.

singhharsh1708 avatar Sep 07 '26 14:09 singhharsh1708

@Krastanov bumping this up again to finish up on the pr

mahmudsudo avatar Sep 10 '26 13:09 mahmudsudo