igraph-help
[Top][All Lists]
Advanced

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

[igraph] Graph with communities


From: Romildo Martins
Subject: [igraph] Graph with communities
Date: Tue, 14 Apr 2009 20:08:05 -0300

Hi,

with this code is possible generate a graph with blocks and your cohesion...


g2 <- graph.disjoint.union(graph.full(4), graph.empty(2,directed=FALSE))
g2 <- add.edges(g2,c(3,4,4,5,4,2))
g2 <- graph.disjoint.union(g2,g2,g2)
g2 <- add.edges(g2,c(0,6,1,7,0,12,4,0,4,1))
plot(g2,vertex.shape="circle", layout=layout.kamada.kawai)
gBlocks <- cohesive.blocks(g2)
gBlocks$blocks
gBlocks$block.cohesion
plot(gBlocks, layout=layout.kamada.kawai)

is possible generate a similar graph with communities?

g <- 
graph(c(0,1,1,2,0,2,1,3,1,4,3,4,2,5,2,6,5,6,4,5,3,7,3,8,4,8,7,8,4,9,6,10,9,10,9,11,10,11,7,13,13,14,14,16,16,15,11,15,8,12,9,12,12,14,12,16,12,15),
directed=FALSE )
plot(g,vertex.shape="circle", layout=layout.kamada.kawai)
wtc<-fastgreedy.community(g)
community.to.membership(g, wtc$merges, steps=11, membership=TRUE, csize=TRUE)

Thanks a lot!

Romildo




reply via email to

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