Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
By Yanchang Zhao, RDataMining.com
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 http://igraph.sourceforge.net/igraphbook/. 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), graph.star(10, 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
http://www.stanford.edu/~messing/RforSNA.html.
An online textbook on Introduction to social network methods can be
found at http://www.faculty.ucr.edu/~hanneman/nettext/.
More information on R and data mining is available at:
RDataMining: http://www.rdatamining.com
Twitter: http://www.twitter.com/RDataMining
Group on Linkedin: http://group.rdatamining.com
Group on Google: http://group2.rdatamining.com
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.