Skip to content
Back to formatted view

Raw Message

Message-ID: <22957493.post@talk.nabble.com>
Date: 2009-04-08T19:14:43Z
From: jpearl01
Subject: Minimum Spanning Tree
In-Reply-To: <d70c15d40904081019m4fef0802y3a319f2a80f0676c@mail.gmail.com>

Make the graph undirected first and then choose the right plotting
parameters. E.g. the following works fine for me:

set.seed(2)
g <- erdos.renyi.game(100, 300, type="gnm", directed=TRUE)
E(g)$weight <- runif(ecount(g))
mst <- minimum.spanning.tree(g)

mst <- simplify(as.undirected(mst))
lay <- layout.reingold.tilford(mst, root=which.max(degree(mst))-1)
plot(mst, layout=lay, vertex.size=5, asp=FALSE, vertex.color=NA,
       vertex.frame.color=NA)

G.


Thanks for all your help Gabor,  However, I'm unable to get a display in R
which is at all readable.  I'm not sure why that is (if the data is
generated randomly, like in your example the tree builds/reads fine...
however on my dataset whichever node is picked as the root just completely
over powers the rest of the nodes which all clump together in a manner that
is unreadable).  My dataset is:
http://www.nabble.com/file/p22957493/sp_matrix.csv sp_matrix.csv 
If you would like to take a look.  However, as it stands I think I'll have
to find another option.  Thanks again for all your efforts.

~josh
-- 
View this message in context: http://www.nabble.com/Minimum-Spanning-Tree-tp22934813p22957493.html
Sent from the R help mailing list archive at Nabble.com.