Temporal analysis of PEERE networks

Adding time to bibliographic networks

From original raw PEERE networks we obtained networks pCiteD, pWAd, pWKd, pWJd, pYearD, pNPd restricted to the works with a complete description (DC > 0). They can be transformed into corresponding temporal networks:

# transforming Pajek pubyear and two-mode network into netJSON
# by Vladimir Batagelj, October 5, 2016
# --------------------------------------------------------------
# based on:
# transforming Pajek pubyear and two-mode network into
# Ianus ten network
# by Vladimir Batagelj, June 27, 2015 / March 18, 2014
# --------------------------------------------------------------
# twoMode2netJSON('year92.clu','WA92.net','WAInst.ten',instant=True)
 
gdir = 'c:/users/batagelj/work/python/graph/graph'
wdir = "C:/Users/batagelj/work/Python/WoS/BM/netJSON"
import sys, os, re, datetime, json
sys.path = [gdir]+sys.path; os.chdir(wdir)
os.chdir(wdir)
import GraphNew as Graph
 
def twoMode2netJSON(yFile,netFile,jsonFile,instant=True,key='w',replace=True):
   def timer(): return datetime.datetime.now().ctime()
 
   print("Read network:",timer(),flush=True)
   G = Graph.Graph.loadPajek(netFile)
   print("Read years:",timer(),flush=True)
   F = Graph.Graph()
   for v in G.nodesMode(1): F.addNode(v)
   F.loadPajekClu('year',yFile)
   print("Make years:",timer(),flush=True)
   minT = min(F.getNode(v,'year') for v in F.nodes())
   maxT = max(F.getNode(v,'year') for v in F.nodes())
   nr, nc = G._graph['dim']
   for v in G.nodesMode(1): G.setNode(v,'tin', [(F.getNode(v,'year'),maxT+1,1)])
   for v in G.nodesMode(2): G.setNode(v,'tin', [(minT,maxT+1,1)])
   for e in G.links():
      u,v,*r = G._links[e]; t = F.getNode(u,'year')
      G._links[e][4]['tq'] = [(t,t+1,G._links[e][4][key])] if instant else \
         [(t,maxT+1,G._links[e][4][key])]
      if replace: del G._links[e][4][key]
   print("Save temporal network:",timer(),flush=True)
   G.setGraph('temporal',True); G.setGraph('mode',2)
   G.setGraph('dim',(nr,nc))
   G.setGraph('meta',[{"date":timer(),"title":"TwoMode2netJSON"}])
   G.setGraph('time',(minT,maxT)); G.setGraph('temporal',True)         
   G.setGraph('title',"worksXauthors-year instant")
   G.setGraph('Tlabs',{str(y):str(y) for y in range(minT,maxT+1)});
   G.saveNetJSON(jsonFile,indent=2)
   print("Finished:",timer(),flush=True)
   return G
 
# N = twoMode2netJSON('pYeard.clu','pWAd.net','pWAdCum.json',instant=False)
N = twoMode2netJSON('pYeard.clu','pWAd.net','pWAdInst.json',instant=True)

In the network pWAd we have |W| = 22104, |A| = 62106], and nArcs = 80021.

N = twoMode2netJSON('pYeard.clu','pWAd.net','pWAdCum.json',instant=False)
>>>
== RESTART: C:\Users\batagelj\work\Python\WoS\BM\netJSON\twoMode2netJSON.py ==
Read network: Mon Mar  6 10:16:34 2017
Read years: Mon Mar  6 10:16:41 2017
Make years: Mon Mar  6 10:16:42 2017
Save temporal network: Mon Mar  6 10:16:42 2017
Finished: Mon Mar  6 10:16:56 2017
>>>

Derived temporal networks

We copied files pWAdInst.json and pWAdCum.json to /graph/JSON/peere . Using multiplication of networks:

multiply.py

gdir = 'c:/users/batagelj/work/python/graph/graph'
wdir = 'c:/users/batagelj/work/python/graph/JSON/peere'
cdir = 'c:/users/batagelj/work/python/graph/chart'
import sys, os, datetime, json
sys.path = [gdir]+sys.path; os.chdir(wdir)
import TQ
from GraphNew import Graph
# file = 'C:/Users/batagelj/work/Python/graph/JSON/peere/pWAdCum.json'
file = 'C:/Users/batagelj/work/Python/graph/JSON/peere/pWAdInst.json'
t1 = datetime.datetime.now()
print("started: ",t1.ctime(),"\n")
G = Graph.loadNetJSON(file)
t2 = datetime.datetime.now()
print("\nloaded: ",t2.ctime(),"\ntime used: ", t2-t1)
# T = G.transpose()
# Co = Graph.TQmultiply(T,G,True)
# CR = G.TQtwo2oneRows()
CC = G.TQtwo2oneCols()
t3 = datetime.datetime.now()
print("\ncomputed: ",t3.ctime(),"\ntime used: ", t3-t2)
ia = { v[3]['lab']: k for k,v in CC._nodes.items() }
======= RESTART: C:\Users\batagelj\work\Python\graph\graph\multiply.py =======
started:  Mon Mar  6 15:24:04 2017 
loaded:  Mon Mar  6 15:24:06 2017 
time used:  0:00:01.798103
computed:  Mon Mar  6 15:24:20 2017 
time used:  0:00:13.585777
>>> CC._links[(ia['BORNMANN_L'],ia['DANIEL_H'])][4]['tq']
[(2005, 2006, 4), (2006, 2007, 3), (2007, 2008, 4), (2008, 2009, 7), (2009, 2010, 4),
 (2010, 2011, 11), (2011, 2013, 4), (2015, 2016, 1)]
>>> CC._links[(ia['BROWN_D'],ia['RAFF_H'])][4]['tq']
[(2013, 2014, 11)]
>>> CC._links[(ia['SAPER_C'],ia['MAUNSELL_J'])][4]['tq']
[(2009, 2010, 13), (2010, 2011, 1)]
>>> CC._links[(ia['REYES_H'],ia['ANDRESEN_M'])][4]['tq']
[(1997, 1998, 3), (1998, 1999, 1), (2000, 2002, 1), (2004, 2005, 1), (2005, 2006, 2),
 (2006, 2008, 1), (2009, 2010, 2), (2011, 2012, 1), (2013, 2016, 1)]
>>> CC._links[(ia['KRAVITZ_R'],ia['FELDMAN_M'])][4]['tq']
[(2010, 2016, 1)]
>>> CC._links[(ia['DEANGELI_C'],ia['FONTANAR_P'])][4]['tq']
[(2000, 2002, 1), (2003, 2004, 1), (2005, 2012, 1)]
>>> CC._links[(ia['BORNMANN_L'],ia['BORNMANN_L'])][4]['tq']
[(2005, 2006, 4), (2006, 2007, 3), (2007, 2008, 4), (2008, 2009, 9), (2009, 2010, 4),
 (2010, 2011, 14), (2011, 2012, 5), (2012, 2013, 7), (2013, 2014, 2), (2014, 2015, 3),
 (2015, 2016, 6)]
>>> bb = CC._links[(ia['BORNMANN_L'],ia['BORNMANN_L'])][4]['tq']
 
>>> tit = 'BORNMANN_L'
>>> TQmax = 15; Tmin = 1995; Tmax = 2016; w = 600; h = 150
>>> Graph.TQshow(bb,cdir,TQmax,Tmin,Tmax,w,h,tit,fill='orange')

Main journals

gdir = 'c:/users/batagelj/work/python/graph/Nets'
wdir = 'c:/users/batagelj/work/python/graph/Nets/peere'
ndir = 'c:/users/batagelj/work/python/WoS/peere2'
cdir = 'c:/users/batagelj/work/python/graph/chart'
import sys, os, datetime, json
sys.path = [gdir]+sys.path; os.chdir(wdir)
from TQ import *
from Nets import Network as N
jrn = ndir+"/WJd.net"
clu = ndir+"/Yeard.clu"
WJi = N.twoMode2netsJSON(clu,jrn,'WJins.json',instant=True)

J = list(WJi.nodesMode(2))
Jt = [ (j, WJi._nodes[j][3]['lab'], TQ.cutGT(WJi.TQnetInSum(j),0)) for j in J ]
p = [0,1971,1981,1991,2001,2006,2011,2016,3000]

To library TQ we added the function changeTime that recodes a temporal quantity a to new time intervals given by p

def changeTime(a,p):
   i = 0; t = p[i]; v = 0; b = []; cut = False
   for sc,fc,vc in a:
      while t <= sc:
         if v > 0: 
            if not cut: b.append((i,i+1,v)); v = 0
         i = i+1; t = p[i]
      if t < fc:
         v = v + (t-sc)*vc; b.append((i,i+1,v))
         v = (fc-t)*vc; cut = True
      else: v = v + (fc-sc)*vc; cut = False
   if v > 0: b.append((i,i+1,v))
   return(b)

>>> A = [(2,6,1),(8,9,3),(10,13,2),(13,15,4),(18,19,1)]
>>> P = [0,4,11,15,17,20]
>>> changeTime(A,P)
[(1, 2, 2), (2, 3, 7), (3, 4, 12), (5, 6, 1)]
Jr = [ (j,l,TQ.changeTime(a,p)) for (j,l,a) in Jt ]
I = { Jt[j][1] : j for j in range(len(Jt)) }
JL = [ "BEHAV BRAIN SCI", "BMJ OPEN", "BRIT MED J", "CUTIS",
   "J ASSOC OFF AGR CHEM", "JAMA-J AM MED ASSOC", "J SEX MED",
   "LANCET", "MED J AUSTRALIA", "NATURE", "NEW ENGL J MED",
   "PLOS ONE", "SCIENCE", "SCIENTOMETRICS" ]
IJ = [ I[j] for j in JL ]
Ir = [ Jr[i] for i in IJ]

journals.csv

"journal", "1900-70", "1971-80", "1981-90", "1991-00", "2001-05", "2006-10", "2011-15"
"BEHAV BRAIN SCI",       0,     0,    33,    26,     0,     0,     0
"BMJ OPEN",              0,     0,     0,     0,     0,     0,   489
"BRIT MED J",           15,    10,    25,    66,    32,    16,    19
"CUTIS",                 0,     0,     0,     3,    40,    19,     0
"J ASSOC OFF AGR CHEM", 75,     0,     0,     0,     0,     0,     0
"JAMA-J AM MED ASSOC",   0,    11,    46,   126,    49,    33,    23
"J SEX MED",             0,     0,     0,     0,     2,    31,    17
"LANCET",               21,     0,     9,    38,    14,    10,     5
"MED J AUSTRALIA",       1,    20,     3,    10,     7,     9,     7
"NATURE",                3,     9,    29,    71,    26,    21,    16
"NEW ENGL J MED",        0,    18,    27,     9,     3,     3,     4
"PLOS ONE",              0,     0,     0,     0,     0,    27,   146
"SCIENCE",               7,    24,    42,    45,    13,    19,    15
"SCIENTOMETRICS",        0,     0,     6,    25,    18,    44,    78

A visual representation was created in R

> wdir <- "c:/users/batagelj/work/python/graph/Nets/peere"
> setwd(wdir)
> T <- read.csv("journals.csv",row.names=1)
> T
> colMax <- function(data) sapply(data, max, na.rm = TRUE)
> F <- round(t(T)/colMax(T),3)
> rownames(F) <- c("1900-70", "1971-80", "1981-90", "1991-00", "2001-05", "2006-10", "2011-15")
> t(F)
> b <- c("blue","darkred","magenta","darkgreen","orange", "black","gray","gray","red","gray",
+ "green","cyan2","brown","chartreuse4")
> x <- c(3,7,5,5,1, 4,6,4,2,3, 2,6,2,6)
> dx <- c(0.15,0.1,-0.025,-0.14,-0.1, 0,-0.1,0,0.15,0.05, -0.12,-0.05,-0.2,0.15)
> s <- F[,2];
> plot(1:7,s,xlab="years",ylab="papers",main="Proportions of papers",type="n")
> for (k in 1:14) points(1:7,F[,k],col=b[k],type="l",lw=3)
> for (k in 1:14) text(x[k]+dx[k],F[x[k],k]-0.02,as.character(k),cex=0.7)


journals.pdf

   journal                 years
 1 BEHAV BRAIN SCI         1900-70
 2 BMJ OPEN                1971-80
 3 BRIT MED J              1981-90
 4 CUTIS                   1991-00
 5 J ASSOC OFF AGR CHEM    2001-05
 6 JAMA-J AM MED ASSOC     2006-10
 7 J SEX MED               2011-15
 8 LANCET
 9 MED J AUSTRALIA
10 NATURE
11 NEW ENGL J MED
12 PLOS ONE
13 SCIENCE
14 SCIENTOMETRICS
notes/peere/time.txt · Last modified: 2019/05/01 22:44 by vlado
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki