igraph-help
[Top][All Lists]
Advanced

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

[igraph] Detecting communities in networks


From: Narges Zarrabi
Subject: [igraph] Detecting communities in networks
Date: Thu, 5 Apr 2012 10:41:53 +0200

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

reply via email to

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