[R] Merging graphs with common nodes

Gábor Csárdi csardi at rmki.kfki.hu
Wed Mar 23 20:39:24 CET 2011


Hi Sandeep.

On Wed, Mar 23, 2011 at 1:03 PM, ssamberkar <ssamberkar at gmail.com> wrote:
[...]
>
> A -- B in G1
>
> B -- C in G2
>
> so in G3 I would expect
>
> A -- B
>
> B -- C
>
>
> Instead I get B -- Z which baffles me.

This is because the operations are based on the internal vertex ids
and not on the vertex names. You can do two things. One is that you
permute the vertices in your graphs, so that the vertex id match, see
permute.vertices() this. The other is that you take the code from
http://lists.gnu.org/archive/html/igraph-help/2009-10/msg00087.html

Best,
Gabor

> I tried getting around this all day but couldn't come up with the resultant
> graph. I am sure I am missing something basic here but the Igraph
> documentation is not that helpful.
> Any suggestions and tips?
>
> Thanks in advance..
>
>
> --
>
> Sandeep Amberkar
>
> PhD Student,
>
> Bioquant, University of Heidelberg,Germany
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Merging-graphs-with-common-nodes-tp3400017p3400017.html
> Sent from the R help mailing list archive at Nabble.com.
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Gabor Csardi <csardi at rmki.kfki.hu>     MTA KFKI RMKI



More information about the R-help mailing list