
#hlust on dijk distances
#tb = read.table( "_dd-b.tab", sep="\t", fill=T, header=T, row.names=1);
tb = read.table( "_dd-b.tab", sep="\t", fill=T, header=T, row.names=1);
dx = as.dist(tb, diag=T);

# remove 999999 nodes, dx[dx==999999] = NA;
h = hclust( dx,);
plot(h, main="hclust on dijk distances, 3days");


#hclust on dijk-path-possibilities
tb2 = read.table( "_nn.tab", sep="\t", fill=T, header=T, row.names=1);
dx2 = as.dist(tb2, diag=T);
h2 = hclust(dx2);
plot(h2, main="hclust on dijk path possibilities, 3 days");


#how may possibilities?
tmp= unlist(as.matrix(tb2))
product = 1;

num = length( names(tb2) )
for (i in 1:num ) {
 for (j in 1:num) {
   if ( is.na(tmp[i,j]) ) { }
   else { 
     product = product * tmp[i,j];
   }
 }
}
#product = 7.489303e+188 