igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Intersect graphs with different vertices


From: Gábor Csárdi
Subject: Re: [igraph] Intersect graphs with different vertices
Date: Fri, 30 Oct 2009 10:53:06 +0100

Hi Magnus,

On Wed, Oct 28, 2009 at 3:58 PM, Magnus Torfason <address@hidden> wrote:
> Hi all,
>
> I need to intersect two graphs that do not have the same vertices - I am
> using the name attribute to identify vertices. In other words, I would like
> to run:
>
>> g1 <- graph.formula(a-b-c)
>> g2 <- graph.formula(b-c-d)
>> g3 <- graph.intersection(g1,g2)
>
> and have g3 be the same graph as g4, constructed in the following manner:
>
>> g4 <- graph.formula(b-c)
>
> Obviously (obvious enough if you run the code, that is), this does not
> happen. In accordance with the disclaimer in the help file, the attributes
> are ignored.
>
> The question is then: Is there code to achieve this functionality floating
> around somewhere?

no, there is not, unfortunately. There is an issue for it, but nothing
has been ever implemented:
https://bugs.launchpad.net/igraph/+bug/284380

> If not, I'll probably have to create it. Since matching up the real indexes
> in two graphs seems like a not completely trivial task, I expect I would opt
> for constructing two data.frames representing each edgelist, merge them, and
> reconstruct the graph.

Yes, this would work.

> I'd appreciate any helpful pointers on whether there are prettier ways to
> achieve this.
>
> If I end up having to write the function, I'd be willing to share it (it
> seems pretty general), but it would be written in R, not in C, so I'm not
> sure if it would be suitable for inclusion in igraph itself (Gabor/Tamas?).

I think we can put it in the R version. If we end up having a C
version later, then we will just replace it with keeping the
interface, so the users don't recognize anything.

Thanks and Best Regards,
Gabor

> Best,
> Magnus
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

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