Difference between revisions of "Social Network Analysis With Igraph Package Using R"
From AIRWiki
Line 1: | Line 1: | ||
− | = Install the package under R environmemnt = | + | == Install the package under R environmemnt == |
type the command: | type the command: | ||
Line 5: | Line 5: | ||
− | = Starting with the package = | + | == Starting with the package == |
don't forget to load the library: | don't forget to load the library: | ||
<code>library('igraph')</code> | <code>library('igraph')</code> | ||
Line 28: | Line 28: | ||
plot(g) | plot(g) | ||
</code> | </code> | ||
+ | |||
+ | == Macroscopic Analysis == | ||
+ | graph size (number of nodes): | ||
+ | |||
+ | number of edges: | ||
+ | |||
+ | mean degree: | ||
+ | |||
+ | == Node Centrality Analysis == | ||
+ | |||
+ | degree: | ||
+ | |||
+ | closeness: | ||
+ | |||
+ | betweenness: | ||
+ | |||
+ | eigenvector/pagerank: | ||
+ | |||
+ | assortativity: | ||
+ | |||
+ | == Clustering Techniques == | ||
+ | |||
+ | connected components: | ||
+ | |||
+ | edge betweenness: | ||
+ | |||
+ | walktrap: | ||
+ | |||
+ | spinglass: | ||
+ | |||
+ | == References and further informations == | ||
+ | |||
+ | Igraph/R documentation: http://igraph.sourceforge.net/doc/R/00Index.html | ||
+ | |||
[[Category:Tutorial]] | [[Category:Tutorial]] |
Revision as of 12:27, 3 April 2010
Contents
Install the package under R environmemnt
type the command:
install.packages("igraph")
Starting with the package
don't forget to load the library:
library('igraph')
parse a network file in Pajek format and access to its memory representation through the variable 'g':
g <- read.graph(file='/your/path/.../file.net', format='pajek')
list vertex and their attributes of graph g:
V(g) # the list of all nodes
V(g)[0] # access the first node
list.vertex.attributes(g) # the list of all vertex attributes names
V(g)[0]$id # access the attribute 'id' for the first node
list edges/arcs and their attributes of graph g:
E(g) # the list of all edges/arcs E(g)[0] # access the first edge/arc list.edge.attributes(g) # the list of all edges/arcs attributes names E(g)[0]$weight # access the attribute 'weight' for the first node
draw the graph:
plot(g)
Macroscopic Analysis
graph size (number of nodes):
number of edges:
mean degree:
Node Centrality Analysis
degree:
closeness:
betweenness:
eigenvector/pagerank:
assortativity:
Clustering Techniques
connected components:
edge betweenness:
walktrap:
spinglass:
References and further informations
Igraph/R documentation: http://igraph.sourceforge.net/doc/R/00Index.html