Okay, I ran a few quick measurements using the microbenchmark package in R:

> g <- grg.game(1000000, 0.002)
> f.neighbors <- function() { neighbors(g, 10) }
> f.ego <- function() { ego(g, 10, 1) }
> mb <- microbenchmark(f.neighbors, f.ego, times=100000)
> print(mb)
Unit: nanoseconds
        expr min  lq     mean median  uq    max neval
 f.neighbors 294 445 521.6913    457 471 174155 1e+05
       f.ego 290 442 514.9057    456 468 118685 1e+05

Seems like f.neighbors() and f.ego() are completely equivalent (at
least time-wise).

T.


On Fri, Aug 14, 2015 at 9:08 PM, Phil Cui <[email protected]> wrote:
> I compare ego with neighbors through system.time() and it turned out that
> ego was faster, but it may be just based on the couple of examples I tested.
>
> No, I didn't copy the whole graph. Actually, the R code is almost the same
> as the Python one.
>
> ___________________________________________________________
>
> Phil Hengjun Cui
> Drexel University | Electrical and Computer Engineering
> Philadelphia, USA
> ___________________________________________________________
>
> On Fri, Aug 14, 2015 at 12:31 PM, Tamas Nepusz <[email protected]> wrote:
>>
>> > (1) I apply ego to get the neighbors since ego runs faster than
>> > neigbhors:
>>         neighbors_motif_current <- ego( g_OriginGraph, 1, motif_current )
>>
>> Are you sure about that? I would think that ego() is slower.
>>
>> Also, I see no significant difference between the Python and R parts
>> that you have posted - could it be the case that the difference lies
>> elsewhere? For instance, could it happen that you accidentally "copy"
>> a graph or a large subset of it in the R code that you don't do in
>> Python?
>>
>> T.
>>
>> _______________________________________________
>> igraph-help mailing list
>> [email protected]
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to