igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] igraph slow when plotting


From: Simone Gabbriellini
Subject: Re: [igraph] igraph slow when plotting
Date: Fri, 28 Feb 2014 13:38:26 +0100

Hi Gabor,

I see nodes are placed one by one, but without the shape modification this 
happens so quick I cannot even tell it’s happening, but if I modify the shape, 
then all is slowed down so that I can see each node when it’s plotted.

to be more precise:
- if all nodes have the same shape (circle, square, whatever), plotting is fast
- if nodes have different shapes (some circle, some square), then plotting is 
very slow

I am on Mac OSX 10.9.1 and run R version 3.0.2 and igraph 0.6.6

here’s a sample data frame to use with my code (with more nodes, you will see 
more slowness ):

df<-structure(list(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), name = c("a", 
"b", "c", "d", "e", "f", "g", "h", "i", "l", "m", "n"), village = c("A", "B", 
"C", "D", "E", "F", "G", "H", "I", "L", "M", "N"), religion = c("x", "y", "y", 
"y", "y", "x", "x", "x", "x", "x", "y","x"), adoption.lag = c(30, 32, 32, 32, 
0, 30, 30, 30, 0, 1, 22, 22), type = c("potter", "potter", "potter", "potter", 
"city", "potter", "potter", "potter", "potter", "potter", "city", "potter")), 
.Names = c("id", "name", "village", "religion", "adoption.lag", "type"), 
row.names = c(NA, -12L), class = "data.frame”)

thanks,
Simone

Il giorno 28/feb/2014, alle ore 13:04, Gábor Csárdi <address@hidden> ha scritto:

> Hi Simone,
> 
> > library(igraph)
> > g<-graph.empty(n=0, directed=T)
> > # add nodes
> > g<-add.vertices(g, length(df[,1]), attr=df)
> Error in add.vertices(g, length(df[, 1]), attr = df) : 
>   please supply names for attributes
> 
> please send reproducible code, and information about your platform.
> 
> Vertices are indeed plotted one by one if they have different shapes.
> 
> Gabor
> 
> 
> On Fri, Feb 28, 2014 at 6:29 AM, Simone Gabbriellini <address@hidden> wrote:
> Dear List,
> 
> I have observed a strange behavior in igraph with R. If I do:
> 
> g<-graph.empty(n=0, directed=T)
> # add nodes
> g<-add.vertices(g, length(df[,1]), attr=df)
> # plot
> plot(g, vertex.size=3, vertex.label.cex=0.7, vertex.label.dist=0.3)
> 
> it’s fast as usual, but if I do:
> 
> g<-graph.empty(n=0, directed=T)
> # add nodes
> g<-add.vertices(g, length(df[,1]), attr=df)
> # shape visualization, if type = city -> squared, else circle
> V(g)[type=="city"]$shape<-"square"
> V(g)[type=="potter"]$shape<-"circle"
> # plot
> plot(g, vertex.size=3, vertex.label.cex=0.7, vertex.label.dist=0.3)
> 
> then it looks like it plots vertices one by one… and it takes considerably 
> more time… any guess where I am wrong?
> 
> best,
> Simone
> _______________________________________________
> 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




reply via email to

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