igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Drawing MST ???


From: Gábor Csárdi
Subject: Re: [igraph] Drawing MST ???
Date: Thu, 16 Aug 2012 22:15:04 -0400

On Thu, Aug 16, 2012 at 10:11 PM, jameson mcfarlane
<address@hidden> wrote:
> G,
>   Rather than having the straight lines I would prefer to have the drawing
> look like roots of a tree.

Try the 'circular=TRUE' option of the Reingold-Tilford layout generator.

> I would like to see smaller and larger circles
> depending on the number of nodes. Hence, I believe it should be the vertex
> sizes.

Then just set

vertex.size=degree(graph) * 10

or something similar in plot(). The factor 10 might need some experimenting.

You can do interactive plotting via tkplot() and then use
tkplot.getcoords() to query the coords you have manually adjusted.

Gabor

> Thank you,
> jameson
>
>> Date: Thu, 16 Aug 2012 19:00:10 -0400
>> From: address@hidden
>> To: address@hidden
>> Subject: Re: [igraph] Drawing MST ???
>
>>
>> Hi Jameson,
>>
>> On Thu, Aug 16, 2012 at 5:04 PM, jameson mcfarlane
>> <address@hidden> wrote:
>> > 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
>>
>> What do you mean exactly by 'this'? Same font? Vertex sizes? Layout?
>> Labels? Color? Image size? Something else?
>>
>> Or really exactly like mstb.gif? Then just use mstb.gif. :)
>>
>> G.
>>
>> > 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
>> >
>> > _______________________________________________
>> > igraph-help mailing list
>> > address@hidden
>> > https://lists.nongnu.org/mailman/listinfo/igraph-help
>> >
>>
>>
>>
>> --
>> Gabor Csardi <address@hidden> MTA KFKI RMKI
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     MTA KFKI RMKI



reply via email to

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