|
From: | shailesh tripathi |
Subject: | Re: [igraph] igraph-help Digest, Vol 114, Issue 13 |
Date: | Wed, 27 Jan 2016 17:29:46 +0200 |
Send igraph-help mailing list submissions to
address@hidden
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.nongnu.org/mailman/listinfo/igraph-help
or, via email, send a message with subject or body 'help' to
address@hidden
You can reach the person managing the list at
address@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of igraph-help digest..."
Today's Topics:
1. Layout of nodes in a 2D graph with fixed Y-positions and
random non-overlapping X-positions (Charles Novaes de Santana)
----------------------------------------------------------------------
Message: 1
Date: Tue, 26 Jan 2016 17:08:13 +0100
From: Charles Novaes de Santana <address@hidden>
To: Help for igraph users <address@hidden>
Subject: [igraph] Layout of nodes in a 2D graph with fixed Y-positions
and random non-overlapping X-positions
Message-ID:
<address@hidden>
Content-Type: text/plain; charset="utf-8"
Dear all,
Does any of you have an idea about how to automatically generate a layout
for a 2D graph considering that:
1 - the user gives the Y-position of the nodes
2 - the user don't care about the X-position of the nodes
3 - the nodes can have different sizes
4 - the nodes can not overlap
5 - the nodes should show their numeric labels, preferably inside them
I was planning to do this by myself, creating the X-positions according to
the number of nodes in each "level" of the graph and to the maximum size of
a node. And I decided to write to the list just to see if anyone have
implemented it before and could help me.
Please consider the code below as a starting point:
```
library(igraph)
nnodes = 100;#number of nodes is 100
g<-erdos.renyi.game(nnodes,0.07);#random graph with nnodes nodes
ypos<-round(runif(nnodes,min=0,max=3))#positions between 0 and 10
mysizes<-runif(nnodes,min=8,max=16)#sizes between 3 and 10
xpos<-runif(nnodes)
mylayout<-as.matrix(cbind(xpos,ypos))
png("./test.png",width=1980,height=1240,res=100)
plot(g, layout=mylayout, vertex.size=sizes, axes = FALSE, rescale=FALSE,
ylim=range(ypos), vertex.size=mysizes)
dev.off();
```
The resulting figure is here
<https://gist.github.com/cndesantana/43468b24b365c44443af#gistcomment-1680269>
Any suggestion about how to define the vector xpos in such a way that I can
avoid nodes to overlap? Any other suggestion to create the layout?
Thanks for any help!
Charles
--
Um ax?! :)
--
Charles Novaes de Santana, PhD
https://github.com/cndesantana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nongnu.org/archive/html/igraph-help/attachments/20160126/6f4dbcde/attachment.html>
------------------------------
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
End of igraph-help Digest, Vol 114, Issue 13
********************************************
[Prev in Thread] | Current Thread | [Next in Thread] |