On Sun, Nov 24, 2013 at 12:08 AM,  <[email protected]> wrote:
> Hello list,
>
> Please consider the following graph with vertices of two categories ("digit"
> and "char"):
>
>     id <- c("1","2","A","B")
>     category <- c("digit","digit","char","char")
>     from <- c("1","1","2","A","A","B")
>     to <- c("2","A","A","B","1","2")
>
>     nodes <- cbind(id,category)
>     edges <- cbind(from,to)
>
>     g <- graph.data.frame(edges, directed=TRUE, vertices=nodes)
>
> Now I want to contract the vertices based on the attribute "category":

Try this:

g2 <- contract.vertices(g, factor(V(g)$category))

Gabor

[...]

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to