Closed whalesandro closed 10 years ago
I am not sure if this a bug in igraph. Take vertex 1 for example. In g2 it has incident edges 1->2, 1->3, 3->1, 1->8, 1->9, 10->1. Out of these edges, only 1->8 is kept, so the correct answer for vertex 1 is 1. Isn't it?
Hi Gabor, thanks, you are right. i guess i misunderstood this today. sorry for the confusion. Heng
No worries, I am not sure what is right myself, because the definition of "scan-0 them" is not too clear to me. So if you realize igraph is not using the right definition, please reopen this issue. Thanks.
Because he uses mode="all", I believe his code counts edges both from 1->8 and 8->1 in g1, where 8->1 isn't in g2. You're right, it's just matter of how you define it! :-) Thanks!
Yes, but what is the correct definition? I mean the definition used in the paper(s)?
We've never used mode="all" in our papers, i.e., we've been using only "out" so far. Right, Heng? But, by definition, we use ecount(subgraph(g1,neighborhood(g2,k,v,mode)), so I think counting both "in" and "out" for mode="all" seems to be consistent...
ecount(subgraph(g1,neighborhood(g2,k,v,mode))
will give you zero for
k=0
, except if v
has loop edges.
Ah, my bad. That's the definition for k>0. For k=0, we use
sapply(1:n,function(x) {
+ vid <- unlist(neighborhood(g2,1,x,mode));
+ x.rank <- which(sort(vid)==x);
+ degree(induced.subgraph(g1,vid),mode)[x.rank]})
[1] 2 2 2 0 1 0 0 4 1 0
Heng still likes your definition. So, let's leave it as it is.
Hello Gabor,
I should find this earlier but i hope this is not too late. It's better than nothing! a bug was found in local.scan in latest igraph. Could you help us fix it? thanks a lot. The following is reproduced code for verification. local.scan1 is my R function and local.scan is implemented in igraph. Please let me know any question. ... set.seed(123456) g1 <- erdos.renyi.game(n=10,p=0.1,directed=TRUE) g2 <- erdos.renyi.game(n=10,p=0.2,directed=TRUE) local.scan(graph.us=g2,graph.them=g1,k=0,mode='all') local.scan1(g=g2,gp=g1,k=0,mode='all') par(mfrow=c(1,2)) plot(g1);plot(g2); ...
results are ...
Best, Heng