igraph-help
[Top][All Lists]
Advanced

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

[igraph] Drawing MST ???


From: jameson mcfarlane
Subject: [igraph] Drawing MST ???
Date: Thu, 16 Aug 2012 21:04:31 +0000

Hi Everyone,
             I currently have a minimum spanning tree (MST) looking like this: see attachment msta.gif.
But I want it to look like this: mstb.gif
 
Here is the code (below) using igraph. I'd greatly appreciate any help. Thank you
 
library(igraph)
tab <- read.csv("NewJam6.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=5, vertex.size2=10,
     vertex.shape="circle", asp=FALSE,
     vertex.label.cex=0.7, vertex.color="green")
 


From: address@hidden
To: address@hidden
Date: Wed, 8 Aug 2012 16:58:51 +0000
Subject: [igraph] Square Matrix /MST

Hello Everyone,
        I'm rather new to igraph. I am using Windows 7 to create an MST (Minimum Spanning Tree) with the attached data file. However, I keep getting that this data is not a square matrix. Any kind of help will be much appreciated.
 
Thank you,
Jameson

_______________________________________________ igraph-help mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/igraph-help

Attachment: msta.gif
Description: GIF image

Attachment: mstb.gif
Description: GIF image


reply via email to

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