Social Network Analysis with R

By Yanchang Zhao,

If you have tried social network analysis or graph mining with R, you might have already come across package igraph before. The package is designed for graphs and network analysis in R. It can handle large graphs very well and provides functions for interactive graph plotting and many other useful functions.

There is a tutorial on Network Analysis with package igraph by Gabor Csardi at Although the tutorial is still under development, it provides some useful R code examples on
– directed and undirected graphs;
– creating regular graphs, incl. full graphs, stars, rings, lattices and trees;
– creating graphs from real-world data;
– various random graphs;
– importing and exporting graphs in various formats, such as edge list files and Pajek format;
– Vertex and edge sequences and their indexing; and
– network flows and minumum cuts.

Below is a simple example picked up from the above tutorial. It creates a wheel graph and then draws a static plot and an interactive one with different layouts.
> library(igraph)
> g <- graph.union(graph.ring(9),, c=9, mode=”undirected”))
> plot(g, layout=layout.reingold.tilford)
> tkplot(g, layout=layout.kamada.kawai)

Another online resource on R for Social Network Analysis is available at

An online textbook on Introduction to social network methods can be
found at

More information on R and data mining is available at:
Group on Linkedin:
Group on Google:

About Yanchang Zhao

I am a data miner, using R for data mining applications. My work on R and data mining:; Twitter; Group on Linkedin; and Group on Google.
This entry was posted in Data Mining, R and tagged , , . Bookmark the permalink.

2 Responses to Social Network Analysis with R

  1. Pingback: Useful for referring–4-16-2012 « Honglang Wang's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s