In order to practice with network data with R, we have been playing with the Padgett (1994) Florentine’s wedding dataset (discussed in the lecture). The dataset is available from
> plot(nflo, displaylabels = TRUE,
+ boxed.labels =
The next step was to move from the network package to igraph. Since we have the adjacency matrix, we can use it
+ mode = "undirected")
The good thing is that a lot of functions are available, for instance we can get shortest paths, between two specific nodes. And we can give appropriate colors to the nodes that we’ll cross
> V(iflo)$color[L[2:4]]="light blue"
We can also visualize edges, but I found it slightly more complicated (to extract edges from the output)
> EU=unlist(lapply(Eliens,function(x) x%in%liens))
But it works. It is also possible to use some D3js visualization
> library( networkD3 )
> simpleNetwork (df)
Then the next question was to add a vertice to the network. The most simple way to do it is probability through the adjacency matrix
> plot(nflo2, displaylabels = TRUE,
+ boxed.labels =
Then, we’ve been playing with centrality measures.
The goal was to see how related they were. Here, for all of them, “Medici” is the central node. But what about the others?
betw close deg eig
betw 1.0000000 0.5763487 0.8333763 0.6737162
close 0.5763487 1.0000000 0.7572778 0.7989789
deg 0.8333763 0.7572778 1.0000000 0.9404647
eig 0.6737162 0.7989789 0.9404647 1.0000000
Those measures are quite correlated. It is also possible to use a hierarchical graph to visualize how close those centrality measures can be
Instead of looking at values of centrality measures, it is possible to looks are ranks
> for(i in 1:4) rbase[,i]=rank(base[,i])
Here the eigenvector measure is very close to the degree of vertices.
Finally, it is possible to seek clusters (in the context of coalition here, in case a war should start between those families)
> kc <- fastgreedy.community ( iflo )
Here we have 3 classes (+1 for the node that is disconnected from the other families)
+ "light blue")[membership ( kc )]