Hello everyone,

I'm trying to visualize a network with many vertices, where the focus is to detect the evolution of communities over time. My little network has 5000 vertices and 40000 edges, and my biggest network has 240000 vertices and approximately 2 million edges. 

I want to replicate this view (figure a): 

https://dl.dropboxusercontent.com/u/61883020/rede.grande.grupos.tiff 

the authors, Shibata et al (2011), uses the algorithm for visualization large graph layout (LGL), available at igraph::layout.lgl().

The problem is that I could not combine the arguments of the function to generate a network in 'spherical' shape, with low level of overlap between the groups. 

Any suggestions for improving this chart, or suggestion of another layout to analyze the evolution of communities in large networks is important for me.

Regards

Roney



# ------------------------------
# Start R code
# ------------------------------

# load igraph() and plyr()
library(igraph)
library(plyr)


# Creating a random network with four strongly connected components 
# This will ensure homogeneous groups 
#
g <- barabasi.game(100, m=4) + barabasi.game(100, m=5) + barabasi.game(100, m=2) + barabasi.game(300, m=4)

# add links between groups
g <- igraph::add.edges(
		       g, 
		       c(1,101, 
			 199,201,
			 299,301,
			 399,401,
			 1,201,
			 1,302,
			 1,451,
			 1,500
			 )
		       )
g

# rename vertices
V(g)$name <- 1:600


# clustering
# A Clauset, MEJ Newman, C Moore: Finding community structure in very large networks
fc <- fastgreedy.community(as.undirected(g))


# four groups were identified, as was to be expected
table(membership(fc))
sizes(fc)

# add vertex group 
V(g)$grupo <- membership(fc)


# I want to color the edges as the group who is citing, 
# for it will do a merge to add this attribute of the vertices in the edges
# 
# create data frame with the vertex attributes 
g.ver <- data.frame(
		    name=V(g)$name, 
		    grupo=V(g)$grupo
		    )
head(g.ver)


# create data frame  with 
g.edg <-  as.data.frame(get.edgelist(g))
head(g.edg)
g.edg <- plyr::rename(g.edg, c('V1'='citante'))
g.edg <- plyr::rename(g.edg, c('V2'='citado'))


# add the group of the vextex 
g.edg2 <- merge(
		g.edg, 
		g.ver, 
		by.x = 'citante',
		by.y = 'name',
		all.x = TRUE, 
		all.y = F
		)
dim(g.edg2)
head(g.edg2)


# add colors for vertex groups
E(g)$grupo.citante <- g.edg2$grupo
E(g)[grupo.citante==1]$color <- 'dark green'
E(g)[grupo.citante==2]$color <- 'dark red'
E(g)[grupo.citante==3]$color <- 'dark blue'
E(g)[grupo.citante==4]$color <- 'sky blue'


# http://igraph.sourceforge.net/doc/R/layout.html
# define the layout of the network
l1 <- layout.lgl(
		 g
		 #                  maxiter = 150,		# The maximum number of iterations to perform (150)
		 #                  maxdelta = vcount(g),	 # The maximum change for a vertex during an iteration (the number of vertices)
		 #                  area = 30*vcount(g)^2 	# The area of the surface on which the vertices are placed (square of 
										#the number of vertices)
		 #                  coolexp = ,	 		# The cooling exponent of the simulated annealing (1.5) 
		 #                  repulserad = vcount(g)  	# Cancellation radius for the repulsion (the area times the number of vertices)
		 #                  cellsize = 			# The size of the cells for the grid. When calculating the repulsion forces between 
									# vertices only vertices in the same or neighboring grid cells are taken into
									# account (the fourth root of the number of area)
		 #                  root = 	 		# The id of the vertex to place at the middle of the layout. The default value is -1 
								#which means that a random vertex is selected
		 )


plot(
   g, 
   layout = l1,
   vertex.label = NA, 
   vertex.size = 0.0000001,
   edge.arrow.size = FALSE,
   edge.arrow.width = FALSE,
   )

# ------------------------------
# End R code
# ------------------------------
	[[alternative HTML version deleted]]

