igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Detecting communities in networks


From: 何伟
Subject: Re: [igraph] Detecting communities in networks
Date: Fri, 6 Apr 2012 20:59:58 +0800

The nodes of same color are belong to the same community. The red edges are edges between different communities.

在 2012年4月5日 下午4:41,Narges Zarrabi <address@hidden>写道:
Hi,

I am also using the following code, taken from igraph examples (http://igraph.sourceforge.net/screenshots2.html#8) , to detect communities in networks.
Could you please let me know what the nodes color and the red color of the edges represent in this example? Thanks in advance!

library(igraph)
g <- read.graph("karate.net", format="pajek")

cs <- leading.eigenvector.community.step(g)
V(g)$color <- ifelse(cs$membership==0, "lightblue", "green")

scale <- function(v, a, b) {
  v <- v-min(v) ; v <- v/max(v) ; v <- v * (b-a) ; v+a
}

V(g)$size <- scale(abs(cs$eigenvector), 10, 20)
E(g)$color <- "grey"
E(g)[ V(g)[ color=="lightblue" ] %--% V(g)[ color=="green" ] ]$color <- "red"

tkplot(g, layout=layout.kamada.kawai, vertex.label.font=2)

Regards,
Narges

_______________________________________________
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]