Hello,

I'm trying to intersection of multiple graphs where the graph objects are
stored in a list.

For example,

library(igraph)
g1 <- graph.formula(A -- B -- C -- D)
g2 <- graph.formula(C -- E -- D -- C)
g3 <- graph.formula(B -- C -- D -- A)

listg <- list(g1, g2, g3)

If I mention individual graph objects separately, I obtain the desired
result

intersection(listg[[1]], listg[[2]], listg[[3]], keep.all.vertices = FALSE)
IGRAPH UN-- 2 1 --
+ attr: name (v/c)
+ edge (vertex names):
[1] C--D

But I get the following error message when I use the list

intersection(listg, keep.all.vertices = FALSE)
Error in UseMethod("intersection") :
  no applicable method for 'intersection' applied to an object of class
"list"

Since, I need to perform intersection of a large number of graphs >20 with
different combination, it is not feasible to type in individual graph
objects separately.
Using a list would simplify my task to a greater extent.

Could you please let me know how to overcome this problem,?

Regards
*Raunak *
_______________________________________________
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to