Reputation: 1446
Here is an example:
df1 <- graph.data.frame(V1=c(1,1,2,2,3,4), V2=c(2,3,3,5,5,5))
g1 <- graph.data.frame(df1, directed=F)
df2 <- data.frame(V1=c(1,2,2,3,4), V2=c(3,3,5,5,5))
g2 <- graph.data.frame(df2, directed=F)
df3 <- data.frame(V1=c(1,2,3,4), V2=c(3,3,5,5))
g3 <- graph.data.frame(df3, directed=F)
df4 <- data.frame(V1=c(1,1,2,3), V2=c(2,3,4,5))
g4 <- graph.data.frame(df4, directed=F)
Now create a list
mylist <- list(g1, g2, g3, g4)
And now look for the intersection
res <- intersection(mylist, keep.all.vertices=FALSE)
But I got this weird result:
Error in useMethod(intersection): no applicable method for 'intersection' applied to an object of class list
Any help with be appreciated, I am using igraph version 1.0.1
Upvotes: 1
Views: 223
Reputation: 37661
this seems like a bit of a hack, but you can get the functionality that you are looking for with:
do.call(intersection, c(mylist, keep.all.vertices=FALSE))
Upvotes: 1