R: performance of getting adjacent edges
Bug #951571 reported by
Artem Tarasov
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
igraph |
Fix Released
|
High
|
Gábor Csárdi |
Bug Description
R bindings are unusable on large graphs.
Getting edges adjacent to a given vertex should be O(#adj. edges) operation.
e.g.:
g <- graph.lattice (c(1000, 1000))
E(g)[adj(0)]
As far as I see from reading rinterface.c, this operation uses a logical vector of length |E|, and that takes inappropriate amount of time. Shouldn't something like hashset be used instead?
Related branches
description: | updated |
To post a comment you must log in.
Indeed, the E() and V() functions are bad for large graphs. You can use the incident() (from 0.6) and neighbors() (and other) igraph functions, those are way faster: time(incident( g, 1)) time(E( g)[adj( 1)])
> system.
user system elapsed
0.000 0.000 0.001
> system.
user system elapsed
0.441 0.261 0.897
I agree, though, that this should be at least documented.