Transforming WoS2Pajek data

Temporal collaboration network

  1. WA → N = n(WA)
  2. Cn(N) → pS core → A'
  3. extract from WA subnetwork S on W(A')xA'
  4. add time to S
  5. compute temporal collaboration C = t(S)*S
read network WA
read partition DC
Partition/Create Constant [75930 2]
select DC as first partition
select constant as second partition
Partitions/Fuse Partitions
Operations/Extract Subnetwork [1,2]
read Year
select DC as second partition
Partitions/Extract Subpartition [1]
relabel DCyear
play macro normal
Network/2-Mode Network/Transpose 2-Mode
select normalized network as second
Networks/Multiply Networks [Yes]
Network/Create Vector/Generalized Core/Sum/All
Vector/Make Partition/by Intervals/Selected [4.0]
Operations/Extract Subnetwork [2]
Draw
select normalized network
Partition/Create Constant [7950 0]
select partition obtained from vector as second
Partitions/Fuse Partitions
Operations/Network+Partition/Extract  [0,2]
Network/Partition/Degree/Output
Network/2-mode/Partition into 2 Modes
select 2-mode partition as second
select outdeg partition as first
Partition/Extract [1]
relabel active
select DCyear as first
select active as second
Partitions/Extract [1-*]
Partition/Create Constant [92 1]
select active as first
select constant partition as second
Partitions/Fuse Partitions
Operations/Network+Partition/Extract  [1-*]
save Net92 network
save year92 partition

PICTURE pS-core at level 4.

toTime.py

import os, re, pickle, json, datetime
os.chdir("C:/Users/batagelj/work/Python/WoS/SN5/time")
from timeR import *

def timer(): datetime.datetime.now().ctime()

nr = 1346; nc = 92; ymax = 2008
clu = open('year92.clu','r')
k = -1; cl = [0]*nr
line = clu.readline()
print("Read publication years:",timer(),flush=True)
while True:
   line = clu.readline()
   if not line: break
   num = eval(line.strip())
   k = k+1
   cl[k] = num
clu.close()

W = [[ [] for i in range(nc)] for j in range(nr)]
net = open('N92.net','r')
print("Read network:",timer(),flush=True)
while True:
   line = net.readline()
   if line.startswith("*Arcs"): break
print("Read arcs:",timer(),flush=True)
while True:
   line = net.readline()
   if not line: break
   L = re.split('\s+',line.strip())
   if len(L)<3: break
   u = eval(L[0])-1; v = eval(L[1])-nr-1; w = eval(L[2])
   t = cl[u]
#   W[u][v] = sum(W[u][v],[(t,t+1,w)])
   W[u][v] = sum(W[u][v],[(t,ymax,w)])
net.close()
print("Compute collaboration net:",timer(),flush=True)

C = [[ [] for i in range(nc)] for j in range(nc)]
for u in range(nc):
   for v in range(u,nc):
      s = []
      for t in range(nr):
         if (len(W[t][u])>0) and (len(W[t][v])>0):
             s = sum(s,prod(W[t][u],W[t][v]))
      C[u][v] = s       
#      if u==v: C[u][v] = s
#      else: C[u][v] = sum(s,s)
                     
print("Finished:",timer(),flush=True)

names = ['COHEN_S', 'BORGATTI_S', 'CARLEY_K', 'GALASKIE_J', 'BURT_R', 'FREEMAN_L',
 'SMITH_R', 'WASSERMA_S', 'HOLLAND_P', 'LEINHARD_S', 'NEWMAN_M', 'PESCOSOL_B', 
 'BARABASI_A', 'LIN_N', 'WELLMAN_B', 'KNOKE_D', 'PAPPI_F', 'ALBERT_R', 'HOLME_P',
 'WATTS_D', 'JOHNSON_C', 'WHITE_D', 'BERNARD_H', 'BREWER_D', 'LATKIN_C', 'MARSDEN_P',
 'ROTHENBE_R', 'VALENTE_T', 'SMALL_H', 'SNIJDERS_T', 'BERKMAN_L', 'MILLER_M',
 'BREIGER_R', 'KRACKHAR_D', 'WHITE_H', 'KILDUFF_M', 'MARTIN_J', 'SCOTT_J',
 'LEYDESDO_L', 'KLOVDAHL_A', 'MOODY_J', 'FRANK_O', 'PARK_J', 'BONACICH_P',
 'STROGATZ_S', 'BATAGELJ_V', 'MIKA_P', 'JOHNSON_J', 'MORGAN_D', 'FAUST_K',
 'MILARDO_R', 'HAMPTON_K', 'DOREIAN_P', 'HUMMON_N', 'MIZRUCHI_M', 'LITWIN_H',
 'KADUSHIN_C', 'YAMAGUCH_K', 'JOHNSEN_E', 'PATTISON_P', 'ROBERTS_J', 'MORRIS_M',
 'KIM_Y', 'HANSSON_L', 'BJORKMAN_T', 'COHEN_C', 'HAMMER_M', 'FRIEDKIN_N',
 'LAZEGA_E', 'ROBINS_G', 'SKVORETZ_J', 'CHEN_C', 'KILLWORT_P', 'STOKMAN_F',
 'SCHNEGG_M', 'LANG_F', 'ESTRADA_E', 'NEYER_F', 'BUTTS_C', 'EVERETT_M',
 'FERLIGOJ_A', 'FARARO_T', 'SEIKKULA_J', 'SCHWEIZE_T', 'HIRSCH_B', 'BIENENST_E',
 'STEINHAU_H', 'BOYD_J', 'SEIDMAN_S', 'METZKE_C', '[ANON]_', 'IACOBUCC_D']
listMatrix(C,names,False)
time = [ str(y) for y in range(1969,2008)]
socnet = {}

socnet['tit'] = '92 most collaborative socnetters'
socnet['num'] = nc
socnet['nam'] = names
socnet['tim'] = time
socnet['Cn'] = C
socnet['WAn'] = W
with open("socnetCum.p","wb") as p: pickle.dump(socnet,p)
with open('socnetCum.json',mode='w',encoding='utf-8') as f: json.dump(socnet,f,indent=2)
tq/time/wos.txt · Last modified: 2016/05/26 09:27 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