Turkish Nomads
From InterSciWiki
http://intersci.ss.uci.edu/wiki/htm/NomadGenealogy.htm
#download http://intersci.ss.uci.edu/wiki/pub/kin/PajekRullaNomads2.r http://intersci.ss.uci.edu/wiki/pub/kin/PajekSourceullaNomads2.r #put in an appropriate director (as below for PC) to call as scource #net=source("http://intersci.ss.uci.edu/wiki/pub/kin/Ulla/PajekSource.r") net=source("http://intersci.ss.uci.edu/wiki/pub/kin/Ulla/PajekR.r") library(sna) gplot(n1) ###gplot(n1, coord = cbind(4*v2,4-v1),gmode = "digraph", vertex.col=v1, vertex.cex=2,label = c(1:dim(n1)[2])) #mode = coord gplot(n1, coord = cbind(4*v2,v1),gmode = "digraph", vertex.col=v1, edge.col=c(1,2), vertex.cex=2, label = c(1:dim(n2)[2])) #mode = coord
[edit]
n2=n1 ###gplot(n2, coord = cbind(4*v2,4-v1),gmode = "digraph", vertex.col=v1, vertex.cex=2,label = c(1:dim(n2)[2])) #mode = coord gplot(n2, coord = cbind(4*v2,v1),gmode = "digraph", vertex.col=v1, edge.col=c(1,2), vertex.cex=2, label = c(1:dim(n2)[2])) #mode = coord ###gplot(n1, coord = cbind(4*v2,v1),gmode = "digraph", vertex.cex=0.3)#,l,xlim=c(0,1)) #mode = coord gplot(n1, coord = cbind(4*v2,v1),gmode = "digraph", vertex.col=v1, edge.col=c(1,2), vertex.cex=2, label = c(1:dim(n2)[2])) #mode = coord v5=.1*as.integer(v2) v6=1+as.integer(v5) v4=1+v1 ###gplot(n1, coord = cbind(v4,v6),gmode = "digraph", vertex.cex=0.3,xlim=c(4,9))#,l) #mode = coord gplot(n1, coord = cbind(4*v2,v1),gmode = "digraph", vertex.col=v1, edge.col=c(1,2), vertex.cex=2, label = c(1:dim(n2)[2])) #mode = coord
Help in R gplot from Carter #skip these #gplot(n1, coord = cbind(v1,1-v1),gmode = "digraph", vertex.col=v1, vertex.cex=2) #gplot(n1, mode = "fruchtermanreingold",gmode = "digraph", vertex.col=v1) #mode = #gplot(n1, mode = "mds",gmode = "digraph", vertex.col=v1) #mode = "fruchtermanreingold" #gplot3d(n1, mode = "mds",gmode = "digraph", vertex.col=v1) #mode = "fruchtermanreingold" is.matrix(n1) is.matrix(n2) dim(n2) lensqrt=length(n1)^.5 library(gtools) m=max(v1) #WITH REPETITION START HERE n2=n1 m3=n2 for (igen in 2:m) {#0 n2 <- m3 numnodes=0 #create permutation F1=0 #female row i save FOR THIS GENERATION for(i in 1:lensqrt) {#1 for(j in 1:lensqrt) {#2 if (v1[i]==igen & n2[i,j]==2) {#3 numnodes=numnodes+1 F1[numnodes] <- i }#3 put row i in the permutation list }#2 }#1 numnodes=0 FJ=0 #female col j save FOR THIS GENERATION for(i in 1:lensqrt) {#1 for(j in 1:lensqrt) {#2 if (v1[i]==igen & n2[i,j]==2) {#3 numnodes=numnodes+1 FJ[numnodes] <- j }#3 put col j i in a list of the same order }#2 }#1 gplot(m2, coord = cbind(4*v2,4-v1),gmode = "digraph", vertex.col=v1, vertex.cex=2) #mode = coord numnodes #?("if") ?("for") help - not much use m2=n2 num=length(F1) f1=0 f2=0 fj=0 f1 <- F1[1:num] #to permute i list fj <- FJ[1:num] #matching j list f1 #rows to permute f2 <- permute(f1) #permute to permute list f2 #these are the permuted-i locations #permutation created for columns numnodes ##CREATE NEW NETWORK #delete the old ties of type 2 for (i in 1:lensqrt) {#1 for (j in 1:lensqrt) {#2 if (v1[i]==igen & n2[i,j]==2) m2[i,j] <- 0 }#2 }#1 #create permuted tie as type 2 #3 for (i in 1:num) m2[f2[i],fj[i]] <- 2 #3 #IS THIS RIGHT FOR ROW AND COLUMN? for (i in 1:num) m2[fj[i],f2[i]] <- 2 #3 #IS THIS RIGHT FOR ROW AND COLUMN? m3=m2 gplot(m3, coord = cbind(4*v2,4-v1),gmode = "digraph", vertex.col=v1, vertex.cex=2,label = c(1:dim(m3)[2])) #mode = coord, label = c(1:dim(m3)[2]), #gplot(m3, coord = cbind(4*v2,4-v1),gmode = "digraph", vertex.col=v1, vertex.cex=2) #mode = coord }#0

