rigraph icon indicating copy to clipboard operation
rigraph copied to clipboard

feat: expose igraph 0.10 functions - `any_mutual()`, `invalidate_cache()`, and 8 generator functions

Open Copilot opened this issue 4 months ago • 1 comments

Exposes priority 0 functions and new graph generators from igraph 0.10 for the first R release based on 0.10.

Functions Added

Priority 0:

  • any_mutual() - checks if directed graph has any mutual edges (wraps igraph_has_mutual)
  • invalidate_cache() - invalidates cached properties for debugging

Generators (with make_ prefix):

  • make_wheel() - wheel graph
  • make_circulant() - circulant graph
  • make_turan() - Turán graph
  • make_generalized_petersen() - generalized Petersen graph
  • make_full_multipartite() - complete multipartite graph
  • make_regular_tree() - regular tree
  • make_symmetric_tree() - symmetric tree with level-specific branching
  • make_triangular_lattice() - triangular lattice

Implementation

  • Added public wrappers in R/make.R, R/structural-properties.R, R/utils.R
  • Updated tools/stimulus/functions-R.yaml and regenerated bindings via Stimulus
  • Handled multi-return functions (make_turan, make_full_multipartite) that return both graph and vertex type attributes

Example

# Check for mutual edges
g <- make_graph(c(1, 2, 2, 1), directed = TRUE)
any_mutual(g)  # TRUE

# Create graph generators
wheel <- make_wheel(10)  # 10 vertices, 18 edges
turan <- make_turan(12, 3)  # 12 vertices split into 3 partitions
V(turan)$type  # partition membership

Not Included

  • make_hexagonal_lattice() - not yet in cigraph's interfaces/functions.yaml
  • Functions already exposed: is_forest(), is_acyclic(), graph_center(), hits_scores(), weighted radius()/eccentricity()
Original prompt

This section details on the original issue you should resolve

<issue_title>0.10 functions that should be exposed</issue_title> <issue_description>## Priority 0

This is a list of functions that are new in 0.10 and should probably be exposed in the very first R/igraph release based on 0.10. Should be easy through auto-generation. The igraph_ part is omitted from function names.

  • [x] is_forest and is_acyclic
  • [ ] has_mutual -> any_mutual
  • [ ] invalidate_cache — we need this for debugging
  • [ ] ... ?

Priority 1

These would be nice to expose soon though perhaps not in the first release. Several of these were requested by users. Auto-generation is not always possible.

  • [ ] hub_and_authority_scores to replace separate hub and authority score calculation
  • [x] get_k_shortest_paths igraph/rigraph#972
  • [ ] graph_center
  • [ ] ... ?

Add support for extra features to existing functions. These are often a separate function in C, but should be integrated into the same function in R.

  • [ ] radius_dijkstra and eccentricity_dijkstra (i.e. weight support for both, igraph/rigraph#893)
  • [ ] distances_cutoff (cutoff support)
  • [ ] ... ?

Generators (probably all of these can be auto-generated):

  • [ ] circulant
  • [ ] turan
  • [ ] wheel
  • [ ] full_multipartite
  • [ ] regular_tree
  • [ ] symmetric_tree
  • [ ] triangular_lattice
  • [ ] hexagonal_lattice
  • [ ] generalized_petersen
  • [ ] ... ?

</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes igraph/rigraph#912

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Oct 26 '25 11:10 Copilot

This is exposing stuff that there's already another PR for, such as full_multipartite.

szhorvat avatar Oct 26 '25 12:10 szhorvat