# Multi-relations network plot

This post is about the visualisation of the relations and their timing in our historical data set about the Antwerp-Brussels-Oudenaarde tapestry complex ( more details about the data set are at the project website).

This plot will be a first attempt to visualize the complex data, therefore in a first step we reduced the roles of each vertex to the following categories: “tapissier” , “mother”, “father”, “child”, “painter”,”legatee”, “erfgenaam”.  We chose those categories, because they appear many times in the dataset. Therefore, we thought that they are a nice starting point.

Before we show the network visualizations, we have a first look at a basic histrogram of the time evolution of the edges in our network. This step turned out to be very helpful to decide how to plot the dynamic network.

Based on this graph, we decided that we will work with discrete time steps of 10-20 year steps to capture the evolution of the network over time. We used color coding to represent the different types of roles each person may take.

The networks viz starts with the  year 1595-1615 and each picture is a step omtp tje future of 20 years. The size of each node is the log of the degree (which is the number of connecitons of an edge to other edges).

A drawback of the visualization is that it is quite difficult to interpretat beyond the basic insights we already saw in the histogram. Especially, the third and fourth network visulization are too dense to be useful for visual analytics.

Hence, we need to look beyond classical node-link diagrams for our task.

For the interested reader here are the relevant sections of R codes. For the plotting part code we adapated the following great contribution.

The idea of ploting the dynamic network in discrete time slices and the implement this, is inspired by the examples in “Statistical Analysis of Network Data with R”, Ch. 10,  written by Kolaczyk, Eric D., Csárdi, Gábor.

``` ##ETN is the edges data frame with numerical columns Source, Target (that are the #outgoing node ID and the incoming node ID), the edge attributes year and label. The data #frame vids is the data.frame with the relevant node informations.&amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;gt;
library(igraph)
library(plyr)
library(dplyr)&lt;/pre&gt;
#reduce number of roles #first define role vector and then subset the edges
# to network data frame
roles.inc=c('tapissier', 'mother', 'father', 'child', 'painter','legatee', 'erfgenaam')
edges.to.network\$Rol1=as.character(edges.to.network\$Rol1)
edges.to.network\$Rol2=as.character(edges.to.network\$Rol2)
etn.net=edges.to.network[edges.to.network\$Rol1 %in% roles.inc,] etn.net=etn.net[etn.net\$Rol2 %in% roles.inc,] #create edge attribute time since minimum year
etn.net\$time=etn.net\$Year-min(etn.net\$Year,na.rm=T) #vertex data frame vids = sort(unique(c(etn.net\$Source, etn.net\$Target)))
g.week = graph.data.frame(etn.net[, c('Source', 'Target', 'Year','Label')],
vertices=data.frame(vids), directed=T)
g.sl10 = lg.sl10 <- lapply(1:8, function(i) { g = subgraph.edges(g.week,
E(g.week)[Time \> 20*(i-1) & Time \<= 20*i],
delete.vertices=FALSE)
simplify(g)
})png(file='try2%03d.png', width=1600,height=900) #Output for each frame will be a png with HD size 1600x900 #Time loop starts
#first number in seq determinates starting value, second number the end value, the third
#number is the step size
for(time in seq(2,7,1)){ gt = g.sl10[[time]] #use only network present at t=time #color code the roles
V(gt)\$color[V(gt)\$Status=='tapissier' ] = '#66C2A5' #lime green
V(gt)\$color[V(gt )\$Status=='mother'] = '#FC8D62' #orange
V(gt)\$color[V(gt )\$Status=='father'] = '#8DA0CB' #lila
V(gt)\$color[V(gt )\$Status=='child'] = '#E78AC3' # Very soft pink
V(gt)\$color[V(gt )\$Status=='painter']='#A6D854' # Moderate green
V(gt)\$color[V(gt )\$Status=='legatee'] ='#FFD92F' #Vivid yellow
V(gt)\$color[V(gt)\$Status=='erfgenaam']='#E5C494' #Very soft orange #with the new graph, we update the layout a little bit
layout.new = layout_with_fr(gt,coords=layout.old,niter=10,start.temp=0.05,grid='nogrid') #plot the new graph
plot(gt,layout=layout.new,vertex.label='',vertex.size=log(degree(gt)),vertex.frame.color=V(gt)\$color,edge.width=1.5,asp=9/16,margin=-0.15) #use the new layout in the next round
} dev.off() ```