From 25a2ad18088339a79ef13871ee8b2be014842091 Mon Sep 17 00:00:00 2001 From: Mahmud Bello Date: Thu, 26 Mar 2026 19:12:01 +0100 Subject: [PATCH 1/3] fix : pr complains fixed --- docs/src/ecosystem/graphalgorithms.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/src/ecosystem/graphalgorithms.md b/docs/src/ecosystem/graphalgorithms.md index 044febf8d..9d8486f79 100644 --- a/docs/src/ecosystem/graphalgorithms.md +++ b/docs/src/ecosystem/graphalgorithms.md @@ -38,6 +38,21 @@ true Here, dispatching via `NautyAlg()` implicitly converts `g` to a _nauty_-compatible format and uses _nauty_ for the isomorphism computation. +Similarly, _IGraphs.jl_ provides a backend for algorithms like `pagerank` and `betweenness_centrality`. You can dispatch to the C implementation by passing `IGraphs.IGraphAlgorithm()`: + +```julia +julia> using Graphs, IGraphs + +julia> g = star_graph(5) +{5, 4} undirected simple Int64 graph + +julia> pagerank(g, IGraphs.IGraphAlgorithm()) +5-element Vector{Float64}: +... +``` + +To quickly convert a _Graphs.jl_ graph to an _IGraphs.jl_ structure, you can use `IGraphs.igraph(g)`. + ### Functions extended by IGraphs.jl A list of functions extended by _IGraphs.jl_ can be obtained with @@ -47,6 +62,11 @@ import IGraphs IGraphs.igraphalg_methods() ``` +### Exclusive algorithms provided by IGraphs.jl + +_IGraphs.jl_ also provides algorithms that are not natively available in _Graphs.jl_ (e.g., `community_leiden`, `sir_model`, `modularity_matrix`, and various layout algorithms such as `layout_kamada_kawai`). Users looking for these functionalities should use `IGraphs.jl` directly. + + ### Functions extended by NautyGraphs.jl A list of functions extended by _NautyGraphs.jl_ can be obtained with From e6575a88b4004530c89cbcb5b9afd7f2e876cd0f Mon Sep 17 00:00:00 2001 From: Mahmud Bello Date: Fri, 27 Mar 2026 19:31:47 +0100 Subject: [PATCH 2/3] feat: add igraph algorithm stubs and documentation #446 --- src/Graphs.jl | 10 +++++++- src/igraphs_stubs.jl | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/igraphs_stubs.jl diff --git a/src/Graphs.jl b/src/Graphs.jl index 5380f88f2..dc394a6ac 100644 --- a/src/Graphs.jl +++ b/src/Graphs.jl @@ -200,6 +200,7 @@ export # diffusion diffusion, diffusion_rate, + sir_model, # eulerian eulerian, @@ -320,6 +321,8 @@ export # community modularity, + modularity_matrix, + community_leiden, core_periphery_deg, local_clustering, local_clustering_coefficient, @@ -454,7 +457,11 @@ export # planarity is_planar, - planar_maximally_filtered_graph + planar_maximally_filtered_graph, + + # Layouts + layout_kamada_kawai, + layout_fruchterman_reingold """ Graphs @@ -478,6 +485,7 @@ and tutorials are available at the """ Graphs include("interface.jl") +include("igraphs_stubs.jl") include("utils.jl") include("frozenvector.jl") include("deprecations.jl") diff --git a/src/igraphs_stubs.jl b/src/igraphs_stubs.jl new file mode 100644 index 000000000..133d856db --- /dev/null +++ b/src/igraphs_stubs.jl @@ -0,0 +1,54 @@ +""" + community_leiden(g::AbstractGraph; resolution=1.0, beta=0.01) + +Find communities in a graph using the Leiden algorithm. +This algorithm is not implemented natively in Graphs.jl. +Please load `IGraphs.jl` to use this function. +""" +function community_leiden(g::AbstractGraph; kwargs...) + error("community_leiden is not implemented natively in Graphs.jl. Please use IGraphs.jl: `community_leiden(g; kwargs...)`") +end + +""" + modularity_matrix(g::AbstractGraph) + +Calculate the modularity matrix of a graph. +This algorithm is not implemented natively in Graphs.jl. +Please load `IGraphs.jl` to use this function. +""" +function modularity_matrix(g::AbstractGraph; kwargs...) + error("modularity_matrix is not implemented natively in Graphs.jl. Please use IGraphs.jl: `modularity_matrix(g; kwargs...)`") +end + +""" + sir_model(g::AbstractGraph, beta, gamma; no_sim=100) + +Simulate a SIR (Susceptible-Infected-Recovered) model on a graph. +This algorithm is not implemented natively in Graphs.jl. +Please load `IGraphs.jl` to use this function. +""" +function sir_model(g::AbstractGraph, beta, gamma; kwargs...) + error("sir_model is not implemented natively in Graphs.jl. Please use IGraphs.jl: `sir_model(g, beta, gamma; kwargs...)`") +end + +""" + layout_kamada_kawai(g::AbstractGraph) + +Calculate a graph layout using the Kamada-Kawai algorithm. +This algorithm is not implemented natively in Graphs.jl. +Please load `IGraphs.jl` to use this function. +""" +function layout_kamada_kawai(g::AbstractGraph; kwargs...) + error("layout_kamada_kawai is not implemented natively in Graphs.jl. Please use IGraphs.jl: `layout_kamada_kawai(g; kwargs...)`") +end + +""" + layout_fruchterman_reingold(g::AbstractGraph) + +Calculate a graph layout using the Fruchterman-Reingold algorithm. +This algorithm is not implemented natively in Graphs.jl. +Please load `IGraphs.jl` to use this function. +""" +function layout_fruchterman_reingold(g::AbstractGraph; kwargs...) + error("layout_fruchterman_reingold is not implemented natively in Graphs.jl. Please use IGraphs.jl: `layout_fruchterman_reingold(g; kwargs...)`") +end From 884b2779c102b65f767ef9bf651c2d028519d0a9 Mon Sep 17 00:00:00 2001 From: Mahmud Bello Date: Sat, 28 Mar 2026 02:46:25 +0100 Subject: [PATCH 3/3] fix: resolve formatter, docs, and changelog CI errors --- CHANGELOG.md | 1 + docs/src/advanced/experimental.md | 12 ++++++++++++ src/igraphs_stubs.jl | 20 +++++++++++++++----- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30638257c..71f44ea80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ We follow SemVer as most of the Julia ecosystem. Below you might see the "breaki ## unreleased - `is_articulation(g, v)` for checking whether a single vertex is an articulation point +- Added documentation stubs for `community_leiden`, `modularity_matrix`, `sir_model`, `layout_kamada_kawai`, and `layout_fruchterman_reingold` pointing users to `IGraphs.jl`. ## v1.14.0 - 2026-02-26 diff --git a/docs/src/advanced/experimental.md b/docs/src/advanced/experimental.md index 60dec4afe..5f6ff1a99 100644 --- a/docs/src/advanced/experimental.md +++ b/docs/src/advanced/experimental.md @@ -36,4 +36,16 @@ Pages = [ "Experimental/Traversals/Traversals.jl", ] +``` + +## External Algorithm Stubs + +The following algorithms are not implemented natively in Graphs.jl but define documentation stubs guiding users to external wrapper packages like `IGraphs.jl`. + +```@docs +Graphs.community_leiden +Graphs.modularity_matrix +Graphs.sir_model +Graphs.layout_kamada_kawai +Graphs.layout_fruchterman_reingold ``` \ No newline at end of file diff --git a/src/igraphs_stubs.jl b/src/igraphs_stubs.jl index 133d856db..142ef8046 100644 --- a/src/igraphs_stubs.jl +++ b/src/igraphs_stubs.jl @@ -6,7 +6,9 @@ This algorithm is not implemented natively in Graphs.jl. Please load `IGraphs.jl` to use this function. """ function community_leiden(g::AbstractGraph; kwargs...) - error("community_leiden is not implemented natively in Graphs.jl. Please use IGraphs.jl: `community_leiden(g; kwargs...)`") + error( + "community_leiden is not implemented natively in Graphs.jl. Please use IGraphs.jl: `community_leiden(g; kwargs...)`", + ) end """ @@ -17,7 +19,9 @@ This algorithm is not implemented natively in Graphs.jl. Please load `IGraphs.jl` to use this function. """ function modularity_matrix(g::AbstractGraph; kwargs...) - error("modularity_matrix is not implemented natively in Graphs.jl. Please use IGraphs.jl: `modularity_matrix(g; kwargs...)`") + error( + "modularity_matrix is not implemented natively in Graphs.jl. Please use IGraphs.jl: `modularity_matrix(g; kwargs...)`", + ) end """ @@ -28,7 +32,9 @@ This algorithm is not implemented natively in Graphs.jl. Please load `IGraphs.jl` to use this function. """ function sir_model(g::AbstractGraph, beta, gamma; kwargs...) - error("sir_model is not implemented natively in Graphs.jl. Please use IGraphs.jl: `sir_model(g, beta, gamma; kwargs...)`") + error( + "sir_model is not implemented natively in Graphs.jl. Please use IGraphs.jl: `sir_model(g, beta, gamma; kwargs...)`", + ) end """ @@ -39,7 +45,9 @@ This algorithm is not implemented natively in Graphs.jl. Please load `IGraphs.jl` to use this function. """ function layout_kamada_kawai(g::AbstractGraph; kwargs...) - error("layout_kamada_kawai is not implemented natively in Graphs.jl. Please use IGraphs.jl: `layout_kamada_kawai(g; kwargs...)`") + error( + "layout_kamada_kawai is not implemented natively in Graphs.jl. Please use IGraphs.jl: `layout_kamada_kawai(g; kwargs...)`", + ) end """ @@ -50,5 +58,7 @@ This algorithm is not implemented natively in Graphs.jl. Please load `IGraphs.jl` to use this function. """ function layout_fruchterman_reingold(g::AbstractGraph; kwargs...) - error("layout_fruchterman_reingold is not implemented natively in Graphs.jl. Please use IGraphs.jl: `layout_fruchterman_reingold(g; kwargs...)`") + error( + "layout_fruchterman_reingold is not implemented natively in Graphs.jl. Please use IGraphs.jl: `layout_fruchterman_reingold(g; kwargs...)`", + ) end