[Top][All Lists]

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

Re: [igraph] I'm getting Different MST each time

From: Gábor Csárdi
Subject: Re: [igraph] I'm getting Different MST each time
Date: Mon, 22 Apr 2013 22:14:24 -0400

Hi, unfortunately we cannot run your code because we don't have the .csv file. Please send some self-contained example that reproduces the problem, e.g. make up some toy data. See e.g.


On Mon, Apr 22, 2013 at 9:44 PM, jameson mcfarlane <address@hidden> wrote:
     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")


igraph-help mailing list

Gabor Csardi <address@hidden>     MTA KFKI RMKI

reply via email to

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