library(igraph)
# leave this as is to obtain repeatable results
set.seed(1337)
# use the function read.graph to read in a network from the facebook dataset
# therefore, choose a number and load the corresponding *.edges-file
# example: '0.edges' for the network 0.
?read.graph
# use the functions vcount and ecount to get some statistics about the graph
vcount()
ecount()
# use the function simplify to remove multiple edges as well as loop edges
?simplify
# did the vertex- or edge-count change?
# gather characteristics of the graph. obtain
# transitivity using the type "localaverage"
?transitivity
# average path length
?average.path.length
# or the degree distribution of the nodes
?degree
# has the chosen graph components?
?components
# if it does, extract the largest component and continue with that!
# obtain a community detection using the edge betweenness method
?edge.betweenness.community
# visualize your findings using the plot function
# parameters for the plot function can be found here:
?igraph.plotting
# color the vertices according to their community membership
# and, if possible, mark the detected communities in the plot. therefore, use the parameter mark.groups