Comments (3)
Thanks. Yes, I know, because the callbacks are called from C which uses 0-based indexing. We could always add one to the results, but this would make the callbacks much slower. Although maybe they are already slow, so it does not matter much.
In any case, this should be either fixed, or at least documented. Thanks!
from rigraph.
The example above crashes my R session now:
> f <- function(graph, data, extra) print(data)
> g <- graph.tree(10)
> tmp <- graph.dfs(g, root=1, "out", in.callback=f)
vid dist
0 0
Error in graph.dfs(g, root = 1, "out", in.callback = f) :
LOGICAL() can only be applied to a 'logical', not a 'double'
*** caught segfault ***
address 0x0, cause 'unknown'
Traceback:
1: .Call(C_R_igraph_finalizer)
2: graph.dfs(g, root = 1, "out", in.callback = f)
from rigraph.
This seems to work correctly now; this is the output of the example from the documentation of graph.dfs
:
> f.in <- function(graph, data, extra) {
+ cat("in:", paste(collapse=", ", data), "\n")
+ FALSE
+ }
> f.out <- function(graph, data, extra) {
+ cat("out:", paste(collapse=", ", data), "\n")
+ FALSE
+ }
> tmp <- dfs(make_tree(10), root=1, "out",
+ in.callback=f.in, out.callback=f.out)
in: 1, 0
in: 2, 1
in: 4, 2
in: 8, 3
out: 8, 2
in: 9, 3
out: 9, 2
out: 4, 1
in: 5, 2
in: 10, 3
out: 10, 2
out: 5, 1
out: 2, 0
in: 3, 1
in: 6, 2
out: 6, 1
in: 7, 2
out: 7, 1
out: 3, 0
out: 1, -1
from rigraph.
Related Issues (20)
- Remove of `scale` parameter of `eigen_centrality()`
- Remove calls to gc()
- CI failure HOT 1
- Protection issues HOT 2
- Review `rinterface_extra.c` for memory management issues introduced during the 0.10 upgrade HOT 1
- Memory leak in `R_igraph_community_to_membership2()`
- assert_character
- Add `igraph_chung_lu_game()` to R
- do these tests need to be revisited or are they good so
- Add `igraph_count_loops()` to R
- Add `igraph_mean_degree()` to R
- check types for other operators
- improve laplacian_matrix docs HOT 1
- fix vendor script
- Add `igraph_invalidate_cache()` to R
- Add `is_clique` and `is_ivs`
- Add `make_hypercube()`
- fix sample_degseq() HOT 1
- fix test-dot.product.game
- Improve make_empty_graph() argument checkings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rigraph.