igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] graph intersection with graph objects stored in a list


From: Raunak Shrestha
Subject: [igraph] graph intersection with graph objects stored in a list
Date: Thu, 24 Nov 2016 20:35:21 -0800

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 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]