No worries, I solved it. The following worked well

do.call(intersection, c(listg, byname="auto", keep.all.vertices=FALSE))


Regards
*Raunak Shrestha*



On Fri, Nov 25, 2016 at 2:39 PM, Raunak Shrestha <[email protected]> wrote:

> Hi Gabor,
>
> Thanks do.call works. However, how do I change parameters below within
> the intersection function ?
>
> byname="auto", keep.all.vertices=FALSE
>
> Regards
> *Raunak Shrestha*
>
>
>
> On Fri, Nov 25, 2016 at 12:59 AM, Gábor Csárdi <[email protected]>
> wrote:
>
>> do.call(intersection, listg)
>>
>> See ?do.call
>>
>> Gabor
>>
>> On Fri, Nov 25, 2016 at 4:35 AM, Raunak Shrestha <[email protected]>
>> wrote:
>> > 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
>> > [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