This is an old revision of the document!


JoC relational constraint

Centrality analysis

US counties - clustering

Remove multiple lines in WA. What is their source?

In Ct remove bidirectional arcs with sum.

Clustering with relational constraints

[read WA]
[read partition DC]
Partition/Create Constant Partition [37690 5]
[select constant partition as Second]
[select DC partition as First]
Partitions/Fuse Partitions
Operations/Network+Partition/Extract Subnetworks [1-*]
Network/Create New Network/Transform/Remove/Multiple Lines/Single Line
[run biblio macro normal]
Network/2-Mode Network/Transpose 2-Mode
[select normalized network as Second]
[select transposed network as First]
Networks/Multiply Networks [Yes]
Network/Create Partition/Degree/All
Operations/Network+Partition/Extract Subnetworks [1-*]
Network/Create New Network/Transform/Arcs->Edges/Bidirected Only/Min Value
Network/Create New Network/Transform/Remove/Loops
[save as Ct.net] 

max ct = 2.28680

dist = 2.5 - ct

Network/Create New Network/Transform/Line Values/Add Constant [-2.5]
Network/Create New Network/Transform/Line Values/Multiply by [-1]
Network/Create Hierarchy/Clustering with Relational Constraints/Options [Max Tolerant]
Network/Create Hierarchy/Clustering with Relational Constraints/Run

clustering_with_relational_constraints

Read clustering in R

Clustering in R

> setwd("C:/Users/Batagelj/work/Python/WoS/joc")
> Pajek2R <- function(cling){
+   tree <- as.integer(read.csv(cling,header=FALSE,skip=1)$V1)
+   N <- length(tree); n <- (N+1) %/% 2
+   merge <- matrix(0,nrow=(n-1),ncol=2)
+   for(i in 1:n) if(tree[i]>0){
+     k <- tree[i]-n
+     if(merge[k,1]==0) merge[k,1] <- -i else merge[k,2] <- -i
+   }
+   for(i in (n+1):N) if(tree[i]>0){
+     k <- tree[i]-n; j <- i-n
+     if(merge[k,1]==0) merge[k,1] <- j else merge[k,2] <- j
+   }
+   return(list(merge=merge,n=n))
+ }
> 
> orDendro <- function(m,i){if(i<0) return(-i)
+   return(c(orDendro(m,m[i,1]),orDendro(m,m[i,2])))}
> 
> orSize <- function(m,i){if(i<0) return(1)
+   s[i] <<- orSize(m,m[i,1])+orSize(m,m[i,2])
+   return(s[i])}
> source("D:\\Data\\counties\\pajek\\varCutree.R")
> n <- 5354; nm <- n-1; np <- n+1
> RM <- Pajek2R("CtMax.clu")
> HM <- read.csv("CtMaxH.vec",header=FALSE,skip=np)[[1]]
> RM$height <- HM
> RM$method <- "Maximum/Tolerant"
> RM$dist.method <- "Euclidean"
> RM$labels <- read.csv("Ct.net",header=FALSE,skip=1,sep=" ",colClasses="character",nrows=n)$V2
> class(RM) <- "hclust"
> RM$call <- "Pajek.data"
> for(i in (nm-100):nm) cat(i,RM$merge[i,],"\n")
notes/net/jocr.1491914197.txt.gz · Last modified: 2017/04/11 14:36 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