[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] I'm getting Different MST each time

From: jameson mcfarlane
Subject: [igraph] I'm getting Different MST each time
Date: Tue, 23 Apr 2013 01:44:42 +0000

     I am creating a minimum spanning tree (MST) with i-graph. For some reason, I seem to get a different MST diagram (nodes in different order) each time I run it. For example, sometimes the primary tree node is say "Jon K.". Other times, it could be "Larry Z." Could any help with what I am doing wrong?
Here is the code:
tab <- read.csv("NewJam12.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=20, height=10)
plot(mst, layout=lay, vertex.size= 5, vertex.size2=15,
     vertex.shape="circle", asp=FALSE,
     vertex.label.cex=0.5, vertex.color="green")


reply via email to

[Prev in Thread] Current Thread [Next in Thread]