You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@szhorvat I don't see the several igraph methods distances() is calling?
This is why I suggested to skip these special cases for now. The interface is often sufficiently different that the C docs are less relevant. That said, you can see it like this:
Look up that distances() calls R_igraph_shortest_paths():
This does NOT mean that this maps to igraph_shortest_paths(). We have to find where R_igraph_shortest_paths() comes from. In this case, it is not auto-generated, so it's found in rinterface_extra.c:
Looking at the sources, you'll see that currently it makes use of several functions such as igraph_distances, igraph_distances_dijkstra, igraph_distances_bellman_ford, distances_johnson, igraph_distances_floyd_warshall, and even calls the locally defined distances_johnson, which in turn calls others:
For a function that .Call()s R_igraph_square_lattice how do I know what igraph functions R_igraph_square_lattice calls? Here's what I think I understand:
If I find "igraph_square_lattice" in tools/stimulus/functions.yaml (or tools/stimulus/functions-R.yaml, which one to use?) it means the igraph function really is "igraph_square_lattice". Or can I simply use the index of the C docs? Edit: no as there's for instance a C function called igraph_shortest_paths so best to use the stimulus YAML.
Regarding src/rinterface_extra.c what we need is for each function defined inside it, to know what igraph function it calls but limited to those igraph functions that are in igraph manual. For instance, a function that calculates the size of a vector is not relevant for our purposes.
Activity
maelle commentedon Aug 30, 2024
It would not need to be automatic.
We could add a special tag automatically for already exposed functions, and manually for new exposed functions.
maelle commentedon Aug 30, 2024
for each function that is defined as or wraps an
_implfunction we can find what is.Callinside it.Now from say
R_igraph_emptywe can know we want to link toigraph_empty. How do we find the link to https://igraph.org/c/doc/igraph-Basic.html#igraph_empty?We could parse the docs folder of the C library every time we update the vendored file. In each xxml file there are links like
https://github.com/igraph/igraph/blob/03760a09cc7195dfaad3a1e60cff1632aa6a6118/doc/basicigraph.xxml#L176
so for each xxml file we can know what C things are documented in it.
#igraph_emptyhttps://igraph.org/c/doc/maelle commentedon Aug 30, 2024
so the tag we'd add would be something like
and we'd use an internal lookup table to know in which chapter of the C docs it is documented.
szhorvat commentedon Aug 30, 2024
You can parse the index, https://igraph.org/c/html/latest/ix01.html
The name of the target to build docs for C locally is
html.Trying to get this from xxml files isn't going to be reliable.
Be careful, some R functions map to multiple C functions! Example
distances().maelle commentedon Aug 30, 2024
maelle commentedon Aug 30, 2024
szhorvat commentedon Aug 30, 2024
Or just skip these special ones for now.
maelle commentedon Aug 30, 2024
maelle commentedon Aug 30, 2024
maelle commentedon Aug 30, 2024
maelle commentedon Aug 30, 2024
maelle commentedon Aug 30, 2024
szhorvat commentedon Aug 30, 2024
This is why I suggested to skip these special cases for now. The interface is often sufficiently different that the C docs are less relevant. That said, you can see it like this:
Look up that
distances()callsR_igraph_shortest_paths():rigraph/R/structural.properties.R
Line 902 in 5298fe8
This does NOT mean that this maps to
igraph_shortest_paths(). We have to find whereR_igraph_shortest_paths()comes from. In this case, it is not auto-generated, so it's found inrinterface_extra.c:rigraph/src/rinterface_extra.c
Line 4186 in 5298fe8
Looking at the sources, you'll see that currently it makes use of several functions such as
igraph_distances,igraph_distances_dijkstra,igraph_distances_bellman_ford,distances_johnson,igraph_distances_floyd_warshall, and even calls the locally defineddistances_johnson, which in turn calls others:rigraph/src/rinterface_extra.c
Line 4159 in 5298fe8
If you see the
_impl, that means full auto-generation, so predictability.maelle commentedon Sep 6, 2024
For a function that
.Call()sR_igraph_square_latticehow do I know what igraph functionsR_igraph_square_latticecalls? Here's what I think I understand:If I find "igraph_square_lattice" in
tools/stimulus/functions.yaml(ortools/stimulus/functions-R.yaml, which one to use?) it means the igraph function really is "igraph_square_lattice". Or can I simply use the index of the C docs? Edit: no as there's for instance a C function called igraph_shortest_paths so best to use the stimulus YAML.If not it means I have to parse
src/rinterface_extra.c. I should try and get better at treesitter then 😅 (which in R only has the grammar for R Include other languages? DavisVaughan/r-tree-sitter#21maelle commentedon Sep 6, 2024
But if I start by functions that are/wrap
_implfunctions then it's easy, as you said.maelle commentedon Sep 6, 2024
Regarding
src/rinterface_extra.cwhat we need is for each function defined inside it, to know what igraph function it calls but limited to those igraph functions that are in igraph manual. For instance, a function that calculates the size of a vector is not relevant for our purposes.schochastics commentedon May 29, 2026
@maelle I feel like this is done or am I wrong?
maelle commentedon Jun 2, 2026
Yes, how could I forget to close the issue? Thanks so much for letting me click this button 😸