Skip to content
Prev 176578 / 398503 Next

Minimum Spanning Tree

Actually,

library(igraph)

tab <- read.csv("http://www.nabble.com/file/p22957493/sp_matrix.csv")
tab <- tab[,-1]

g <- graph.adjacency(as.matrix(tab), weighted=TRUE)
V(g)$label <- V(g)$name

mst <- as.undirected(minimum.spanning.tree(g))

lay <- layout.reingold.tilford(mst, root=which.max(degree(mst))-1)
lay <- cbind(lay[,2], lay[,1])    # rotate
x11(width=15, height=8)
plot(mst, layout=lay, vertex.size=25, vertex.size2=10,
     vertex.shape="rectangle", asp=FALSE,
     vertex.label.cex=0.7, vertex.color="white")

works relatively well for me on your graph. It doesn't for you?

Best,
Gabor
On Wed, Apr 8, 2009 at 9:14 PM, jpearl01 <joshearl1 at hotmail.com> wrote: