Kinship vector format

From InterSciWiki

Jump to: navigation, search


see also: http://www.kintip.net/content/view/74/#Tip_format The paj files currently on Kinsources are in the all-arcs (5 relation numbers) format. But this is just a coincidence. The Tip4Pajek macros allow transforming them into Ore-graph format, and Puck can transform them into P-graph format.

The p-graph vector format for kinship networks was written in Fortran by Douglas R. White in 1991 for the article where it was described with Paul Jorion in 1992.

1992 Representing and Computing Kinship: A New Approach. Douglas R. White, Paul Jorion. Current Anthropology 33(4): 454-463. http://eclectic.ss.uci.edu/~drwhite/pw/White-Jorion1992.pdf

1996 Kinship networks and discrete structure theory: Applications and implications. Douglas R. White, Paul Jorion. Special Issue on Social Network and Discrete Structure Analysis. Social Networks 18(3): 267-314. doi:10.1016/0378-8733(95)00277-4 http://eclectic.ss.uci.edu/~drwhite/pub/KinNetsDiscStr1996.pdf

Vector format consisted of five arrays, for each of j=1,n nodes, each node representing a couple or child of a couple. In the original pgraph software these were represented as follows, with vectors stored in arrays with 20 elements per row.

  • G(j)=the parental node of a male, as son and/or member of a couple in node j.
  • F(j)=ditto for a female, as daughter and/or member of a couple in node j.
  • B(j)=single digit designator for a man with multiple nodes j for marriages
  • Z(j)=single digit designator for a woman with multiple nodes j for marriages
  • L(j)=ordinarily j=1,n for the numbers of successive nodes, or may be used for a numeric labeling of nodes that does not enter into kinship computation.

Vector functions G and F allow very rapid computation and give a great deal of information about structural endogamy and types of consanguineal marriage or affinal relinking.

The set of nodes for brothers, B'=\left \{j | G(j)=k \right \}, and for sisters, Z'=\left \{j | f(j)=k \right \}, include multiple marriages of the same individuals. Because two marriages of the same person are not distinguished from their and a sibling's marriage, functions B and Z normally return the value zero but in the case of same-sex sibling sets where some brothers or sisters have multiple marriages, B(j),j\equiv 1,k and Z(j),j\equiv1,k are assigned to marriage nodes to identify particular individuals.

[edit] Vector files and translations

These files were made for *.VEC files by the fortran program below. They result from four different formats. For format (3) the following error code text is inserted so as not to erase notes in file

ROW 1 TOTAL Number of marriages + TITLE
ROW 2 Husband's parents marriage number
ROW 3 Wife's parents marriage number
ROW 4 missing Sib numbers of Husband 
ROW 5 missing Sib numbers of Wife 
ROW 6 ID numbers (eg 1-20) You can put zeros here to "remove" a node
1 No Vector 5
 1 P-JAV.net   30
 2 P-KHA.net  137
 3 P-KNG.net   28
 4 P-KOM.net   29
 5 P-MOK.net   50
 6 P-WAM.net  440
2 No Relabeling in all 5 Vectors
 1 P-TRI.net  460
3 Error code after 2 vectors (No relabeling)
 1 P-ANU.net  207
 2 P-BEN.net  278
 3 P-DUK.net  114
 4 P-HAS.net   18
 5 P-MAK.net  118
 6 P-MAR.net   26
 7 P-MAZ.net  303
 8 P-MEC.net  236
 9 P-MOH.net  160
10 P-NAT.net   38
11 P-PKN.net  185
12 P-PRE.net  220
13 P-ROI.net   24
4 Relabeling in Vector 5 - have p-___2.net
 1 P-ADN.net  121
 2 P-CAN.net   28
 3 P-DO1.net 2601
 4 P-DO2.net 3731
 5 P-GAB.net  406
 6 P-GAR.net   96
 7 P-GRO.net  287
 8 P-KAR.net   70
 9 P-MOR.net   37
10 P-MYS.net  312
11 P-OCA.net  132
12 P-PUM.net  118
13 P-PUP.net  118
14 P-PUR.net  131
15 P-RED.net   42
16 P-ROY.net 1710
17 P-SAR.net  171
18 P-TOR.net  494
19 P-TUA.net  291
20 P-TW1.net 2316
21 P-VIC.net  106
22 P-YAN.net  220

Previous version

1 No Vector 5 +
 1 P-JAV.net   30* 2 vectors
 2 P-KHA.net  137* 2 vectors
 3 P-KNG.net   28* 2 vectors
 4 P-KOM.net   29* 2 vectors
 5 P-MOK.net   50* 2 vectors
 6 P-WAM.net  440* 2 vectors
2 No Relabeling in all 5 Vectors - mostly computed
 2 P-CAN.net   28* Misplaced in (4) 
 1 P-DO1.net 2601* Right
 2 P-DO2.net 3731* Right
 3 P-DUK.net  114* Right
 4 P-ROY.net 1710* Right
 5 P-SAR.net  171* Right
 6 P-TOR.net  494* Right
 7 P-TRI.net  460* Right
 8 P-TW1.net 2316* Right
3 Error code after 2 vectors (coded elsewhere) No relabeling
 1 P-ANU.net  207* Err
 2 P-BEN.net  278* Err
 3 P-DUK.net  114* Err
 4 P-HAS.net   18* Err
 5 P-MAK.net  118* Err
 6 P-MAR.net   26* Err
 7 P-MAZ.net  303* Err
 8 P-MEC.net  236* Err
 9 P-MOH.net  160* Err
10 P-NAT.net   38* Err
11 P-PKN.net  185* Err
12 P-PRE.net  220* Err
13 P-ROI.net   24* Err
4 Relabeling in Vector 5 - have p-___2.net codes
 1 P-ADN.net  121
 3 P-GAB.net  406
 4 P-GAR.net   96
 5 P-GRO.net  287
 6 P-KAR.net   70
 7 P-MOR.net   37
 8 P-MYS.net  312
 9 P-OCA.net  132
10 P-PUM.net  118
11 P-PUP.net  118
12 P-PUR.net  131
13 P-RED.net   42
14 P-TUA.net  291
15 P-VIC.net  106
16 P-YAN.net  220

[edit] Fortran code

     Douglas R. White V.for Convert pgraph .Vec files to Pajek *.net files
     character*44 txt, txxt
     character*9 name
     character*10 nam2
     integer A(4000), B(4000), C(4000), D(4000), E(4000)
     open (5,file='VarLabN') ! 5th vector same as index         NoNew>0 iflag=0 
     open (6,file='VarLabY') ! 5th vector different than index  iNew>0 iflag=1 new Renumbering
     open (7,file='VarLab0') ! 5th vector missing (only two)
     open (8,file='VarLabE') ! purposive error after 2 vectors (No relabelling) = 5th vector same as index
     
     write (5,'(A)') '2 No Relabeling in all 5 Vectors'
     write (6,'(A)') '4 Relabeling in Vector 5 - have p-___2.net'
     write (7,'(A)') '1 No Vector 5'
     write (8,'(A)') '3 Error code after 2 vectors (No relabeling)'
     open (1,file='VecList')
     iNew=0
     NoNew=0
     do i=1,111    ! CHANGED TO FIRST ONLY - CHANGE BACK
     read (1,'(A9)',end=106) name
     open (2,file=name)
     name(7:9)='net'
     open (3,file=name)
     write (*,*) name
     read (2,'(I4,a)') num, txt
     txxt=txt
     if (num.gt.4000) write (*,*) ' num too big', num
     if (num.gt.4000) stop
     if (num.gt.999) write (*,*) name
     no6=0
     read (2,'(20I4)',end=101,err=102) (A(j),j=1,num)
     read (2,'(20I4)',end=104,err=102) (B(j),j=1,num)
     read (2,'(20I4)',end=99,err=108)   (C(j),j=1,num)
     read (2,'(20I4)',end=99,err=108) (D(j),j=1,num)
     read (2,'(20I4)',end=99,err=108) (E(j),j=1,num)
     goto 109
99    i0=i0+1
     ! THERE IS NO C,D,E
     write (7,'(i3,1x, A,i5)') i0, name, num
     write (3,'(A, I4,7A)') '*Vertices   ',num, ' ', txt, ' ', name
     do j=1,num
     write (3,'(I5,A,i4,a,i4,a)') j, ' "', j, '"'
     enddo
     iflag=-1
     ! THERE IS NO C,D,E
     goto 222
Check if E(j)=j throughout
108  write (*,*) ' READ ERROR', txt ! MAKE ERRORS "NO RELABELING"
     iErr=iErr+1
     write (8,'(i3,1x, A,i5)') iErr, name, num
     no6=1
109   iflag=0
     ! C,D,E exist. EOF reached
     do j=1,num
     if (j.ne.E(j).and.E(j).ne.0) iflag=1  ! SOME DATA HAVE 0s in THE j=1,N array
     enddo
     if (iflag.eq.1) then
     iNew=iNew+1  ! new Renumbering
     write (5,'(i3,1x, A,i5)') iNew, name, num
     endif
     if (iflag.eq.0) then
     if (no6.eq.0) NoNew=NoNew+1
     if (no6.eq.0) write (6,'(i3,1x, A,i5)') NoNew, name, num
     endif
     write (3,'(A, I4,7A)') '*Vertices   ',num, ' ', txt, ' ', name
     ! THERE IS NO C,D,E   iflag=-1
     ! C,D,E exist.        iflag=0 (E same as j) or 1 (E different, iNew>0), 
222  if (iflag.ne.-1) then
     nam2=name
     if (no6.eq.0) nam2(6:10)='2.net'
     if (iflag.eq.1) open (4,file=nam2)  !iflag.eq.1  makes 2nd file when NO relabeling
     !write (*,*) '*Vertices   ',num, ' ', txxt, ' ', nam2
     !write (*,*) '*Vertices   ',num, ' ', txxt, ' ', nam2
     if (iflag.eq.1) write (4,'(A, I4,5A)') '*Vertices   ',num, ' ',
    *txxt, ' ', nam2
     endif
     do j=1,num
     if (C(j).gt.999) then
     write (3,'(I5,A,i4,a,i4,a)') j, ' "', C(j), '-', D(j), '"'
     if (iflag.eq.1) write (4,'(I5,A,i4,a,i4,a)') j, ' "', C(j), '-',
    *E(j), '"'
     else
     if (C(j).gt.99) then
     write (3,'(I5,A,i3,a,i4,a)') j, ' "', C(j), '-', D(j), '"'
     if (iflag.eq.1) write (4,'(I5,A,i3,a,i4,a)') j, ' "', C(j), '-',
    *E(j), '"'
     else
     if (C(j).gt.9) then
     write (3,'(I5,A,i2,a,i4,a)') j, ' "', C(j), '-', D(j), '"'
     if (iflag.eq.1) write (4,'(I5,A,i2,a,i4,a)') j, ' "', C(j), '-',
    *E(j), '"'
     else
     write (3,'(I5,A,i1,a,i4,a)') j, ' "', C(j), '-', D(j), '"'
     if (iflag.eq.1) write (4,'(I5,A,i1,a,i4,a)') j, ' "', C(j), '-',
    *E(j), '"'
     endif
     endif
     endif
     enddo
     write (3,'(A, I4,7A)') '*Arcs'
     if (iflag.eq.1) write (4,'(A, I4,7A)') '*Arcs'
     do k=1,num
     if (A(k).gt.0) write (3,'(3I5,2A)') k,A(k),1,' p Solid',' c Black'
     if (B(k).gt.0) write (3,'(3I5,2A)') k,B(k),2,' p Dots',' c Red'
     if (iflag.eq.1.and.A(k).gt.0) write (4,'(3I5,2A)') k,A(k),1,
    *' p Solid',' c Black'
     if (iflag.eq.1.and.B(k).gt.0) write (4,'(3I5,2A)') k,B(k),2,
    *' p Dots',' c Red'
     enddo
     close(3)
     enddo
     goto 103
101  write (*,*) ' EOF 1'
104  write (*,*) ' EOF 2'
105  write (*,*) ' EOF 3'
106  write (*,*) ' EOF 0'
102  write (*,*) name
103  close (3)
     write (*,'(I4\)') (A(k),k=1,5)
     end

[edit] Links

Pajek_p-graph format example

Personal tools