igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Contracting two vertices into one in Igraph - error


From: Priyanka Kadiyala
Subject: Re: [igraph] Contracting two vertices into one in Igraph - error
Date: Thu, 8 Nov 2012 07:23:58 -0600

Thank you! I had read that part, I just implemented it wrong and was getting an error, the example clarified it further and I successfully tried contracting a few more nodes.

I really appreciate your help and patience! Thank you!

On Thu, Nov 8, 2012 at 7:20 AM, Tamás Nepusz <address@hidden> wrote:
> Of the vertices 1:26, I can also choose two nodes that are not consecutive, as in, I can choose to merge (1,5) or (7,18) into a single vertex. Can this be done?

Quoting myself:

> In general, if you want to merge vertex v into vertex u (assuming that v > u), you will need a contraction vector as follows:
>
> vec <- c(1:(v-1), u, v:(vcount(g)-1))
>
> If v < u, just swap u and v and do the same thing.
In your case, u=1 and v=5 (since you are merging node 5 into node 1), so the contraction vector is:

c(1:4, 1, 5:(vcount(g)-1))

Best,
Tamas


_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help


reply via email to

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