Shameless self promotion: the final results of this exercise have now been published (open access) here. Supplementary material includes updated scripts.

At the moment I am interested not just how people are interacting within different co-authorship networks but how knowledge is shared between co-authorship networks. So I’m trying to figure out how to merge the different networks I’ve developed into one big, comprehensive, co-authorship network. The key to this being successful will be in retaining some identification of the original network (I think they will probably be colour coded) and the authors that collaborate across co-authorship networks will have their own colour. I haven’t figured this bit out just yet…

However, I have managed to merge the networks! And while I haven’t done it the easiest (i.e. combine the .bib files and run the network script from scratch) I think my way will be the most useful for keeping distinct sub-network attributes.

The first step was to draw up a dummy network. My co-authorship networks have thousands of unique authors, it’s much simpler to work with dummy data when working out the kinks (and then hopefully it will translate to the full data-set…).

I then wrote these simple ‘publications’ up as .bib files called ‘pink.bib’, ‘blue.bib’ and ‘orange.bib’. Original. I won’t include them all here but pink.bib looks like this:

@article{Paper1, author = {Allen, A. and Baker, B. and Cook, C.}, journal = {Fictional Journal}, number = {14}, pages = {14--17}, title = {Paper 1}, volume = {29}, year = {2002} } @article{Paper4, author = {Cook, C. and Ferrer, F.}, journal = {Fictional Journal 2}, number = {14}, pages = {14--17}, title = {Paper 4}, volume = {29}, year = {2003} }

You get the idea.

Next I plotted all three networks separately using similar code to that detailed in this post. However, I exported the co-author tables (called dat, see below) so I didn’t have to continually re-run the network script. You can do this using write.table().

write.table(coauth.table, file = "pink.txt")

Once I had all three co-author tables for my three dummy networks (dat, dat2, and dat3) I called them into a fresh R console. I assigned them different vertex attributes (i.e. different colours) and finally merged them.

See the script below!

library(intergraph) library(network) library(igraph) setwd("C:/Users/me/networks") ##FOR PINK FILES dat<- read.table("pink.txt") #you can check the class (format) of the data using the command: class(dat) #dat is a data frame, need to change it to a matrix to work with igraph dat <- as.matrix(dat) class(dat) #here is where we create the adjacency network. Same step as in previous CNA post. auth.graph <- graph.adjacency(dat, mode='undirected', weighted=TRUE) auth.graph #To set all vertices in this network to display as green - this will hopefully come into play when I finalise the joined network dd <- set.vertex.attribute(auth.graph, "color", value = "green") plot(dd, vertex.label.cex=0.8, edge.width = E(dd)$weight)

This gives us the green sub-network.



##FOR BLUE FILES dat2 <- read.table("blue.txt") dat2 <- as.matrix(dat2) auth.graph2<- graph.adjacency(dat2, mode='undirected', weighted=TRUE) auth.graph2 ee <- set.vertex.attribute(auth.graph2, "color", value = "blue") plot(ee, vertex.label.cex=0.8, edge.width = E(ee)$weight)

##FOR ORANGE FILES dat3 <- read.table("orange.txt") dat3 <- as.matrix(dat3) auth.graph3<- graph.adjacency(dat3, mode='undirected', weighted=TRUE) auth.graph3 ff <- set.vertex.attribute(auth.graph3, "color", value = "orange") plot(ff, vertex.label.cex=0.8, edge.width = E(ff)$weight)



Now for the final step – joining the sub-networks into one large co-authorship network. I still need to figure out how to retain the attribute information (colours) for each sub-network, but for now I’m content that I’ve got the bulk of the work done.

##JOIN NETWORKS ##Loses attributes gg <- graph.union(dd, ee, ff) plot(gg)



Hopefully I’ll get the last of the scripting done this week (forever overly-optimistic about how long it takes me!) and can show you the final product soon. Any suggestions are very welcome.