igraph plot slowness

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

igraph plot slowness

Loris Bennett-2
Hi,

With the following data

ibcore01 ibswitch01
ibcore01 ibswitch02
ibcore01 ibswitch03
ibcore02 ibswitch01
ibcore02 ibswitch02
ibcore02 ibswitch03
ibswitch01 node001
ibswitch01 node002
ibswitch01 node003
ibswitch02 node004
ibswitch02 node005
ibswitch02 node006
ibswitch03 node007
ibswitch03 node008
ibswitch03 node009

in the file "topology.txt"

and the following code:

library("igraph")
topo_data <- read.csv(file="topology.txt",head=FALSE,sep="\t")
network_data <-graph.data.frame(topo_data, directed=F)
plot(network_data)

it takes about 5 seconds for the plot to be drawn with R 3.2.0 on a
12-core 2.67 GHz Xeon X5650 server with no other CPU-intensive processes
running.

This strikes me as rather slow, particularly as my full network has over
120 components and the plot takes around 50 seconds.

Am I doing anything wrong?

(I am working over an ssh connection with X forwarding, but plotting to
a PDF file on the server does not seem to be faster.)

Cheers,

Loris

--
This signature is currently under construction.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: igraph plot slowness

jholtman
Here is what it does locally on my PC:

> library("igraph")
>  topo_data <- read.table(text = "ibcore01        ibswitch01
+  ibcore01        ibswitch02
+  ibcore01        ibswitch03
+  ibcore02        ibswitch01
+  ibcore02        ibswitch02
+  ibcore02        ibswitch03
+  ibswitch01      node001
+  ibswitch01      node002
+  ibswitch01      node003
+  ibswitch02      node004
+  ibswitch02      node005
+  ibswitch02      node006
+  ibswitch03      node007
+  ibswitch03      node008
+  ibswitch03      node009" ,head=FALSE)
>  system.time({
+  network_data <-graph.data.frame(topo_data, directed=F)
+  plot(network_data)
+ })
   user  system elapsed
   0.01    0.01    0.03
>
>

Does not seem too slow.  Creating a PDF file takes a little longer:

> library("igraph")
>  topo_data <- read.table(text = "ibcore01        ibswitch01
+  ibcore01        ibswitch02
+  ibcore01        ibswitch03
+  ibcore02        ibswitch01
+  ibcore02        ibswitch02
+  ibcore02        ibswitch03
+  ibswitch01      node001
+  ibswitch01      node002
+  ibswitch01      node003
+  ibswitch02      node004
+  ibswitch02      node005
+  ibswitch02      node006
+  ibswitch03      node007
+  ibswitch03      node008
+  ibswitch03      node009" ,head=FALSE)
>  system.time({
+  network_data <-graph.data.frame(topo_data, directed=F)
+  pdf('test.pdf')
+  plot(network_data)
+  dev.off()
+ })
   user  system elapsed
   0.09    0.00    0.16

The PDF file is attached.  So maybe it is something with your remote
connection.




Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Fri, Jul 3, 2015 at 3:21 AM, Loris Bennett <[hidden email]>
wrote:

> Hi,
>
> With the following data
>
> ibcore01        ibswitch01
> ibcore01        ibswitch02
> ibcore01        ibswitch03
> ibcore02        ibswitch01
> ibcore02        ibswitch02
> ibcore02        ibswitch03
> ibswitch01      node001
> ibswitch01      node002
> ibswitch01      node003
> ibswitch02      node004
> ibswitch02      node005
> ibswitch02      node006
> ibswitch03      node007
> ibswitch03      node008
> ibswitch03      node009
>
> in the file "topology.txt"
>
> and the following code:
>
> library("igraph")
> topo_data <- read.csv(file="topology.txt",head=FALSE,sep="\t")
> network_data <-graph.data.frame(topo_data, directed=F)
> plot(network_data)
>
> it takes about 5 seconds for the plot to be drawn with R 3.2.0 on a
> 12-core 2.67 GHz Xeon X5650 server with no other CPU-intensive processes
> running.
>
> This strikes me as rather slow, particularly as my full network has over
> 120 components and the plot takes around 50 seconds.
>
> Am I doing anything wrong?
>
> (I am working over an ssh connection with X forwarding, but plotting to
> a PDF file on the server does not seem to be faster.)
>
> Cheers,
>
> Loris
>
> --
> This signature is currently under construction.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

test.pdf (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: igraph plot slowness

Loris Bennett-2
Hi Jim,

jim holtman <[hidden email]> writes:

> Here is what it does locally on my PC:
>
>> library("igraph")
>>  topo_data <- read.table(text = "ibcore01        ibswitch01
> +  ibcore01        ibswitch02
> +  ibcore01        ibswitch03
> +  ibcore02        ibswitch01
> +  ibcore02        ibswitch02
> +  ibcore02        ibswitch03
> +  ibswitch01      node001
> +  ibswitch01      node002
> +  ibswitch01      node003
> +  ibswitch02      node004
> +  ibswitch02      node005
> +  ibswitch02      node006
> +  ibswitch03      node007
> +  ibswitch03      node008
> +  ibswitch03      node009" ,head=FALSE)
>>  system.time({
> +  network_data <-graph.data.frame(topo_data, directed=F)
> +  plot(network_data)
> + })
>    user  system elapsed
>    0.01    0.01    0.03
>>
>>
>
> Does not seem too slow.  Creating a PDF file takes a little longer:
>
>> library("igraph")
>>  topo_data <- read.table(text = "ibcore01        ibswitch01
> +  ibcore01        ibswitch02
> +  ibcore01        ibswitch03
> +  ibcore02        ibswitch01
> +  ibcore02        ibswitch02
> +  ibcore02        ibswitch03
> +  ibswitch01      node001
> +  ibswitch01      node002
> +  ibswitch01      node003
> +  ibswitch02      node004
> +  ibswitch02      node005
> +  ibswitch02      node006
> +  ibswitch03      node007
> +  ibswitch03      node008
> +  ibswitch03      node009" ,head=FALSE)
>>  system.time({
> +  network_data <-graph.data.frame(topo_data, directed=F)
> +  pdf('test.pdf')
> +  plot(network_data)
> +  dev.off()
> + })
>    user  system elapsed
>    0.09    0.00    0.16
>
> The PDF file is attached.  So maybe it is something with your remote
> connection.

You're right.  Running locally even the plot of complete network takes
less than 0.2 seconds via the X11 device.  I'll have a closer look at
the connection.

Thanks,

Loris

> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
> On Fri, Jul 3, 2015 at 3:21 AM, Loris Bennett <[hidden email]>
> wrote:
>
>> Hi,
>>
>> With the following data
>>
>> ibcore01        ibswitch01
>> ibcore01        ibswitch02
>> ibcore01        ibswitch03
>> ibcore02        ibswitch01
>> ibcore02        ibswitch02
>> ibcore02        ibswitch03
>> ibswitch01      node001
>> ibswitch01      node002
>> ibswitch01      node003
>> ibswitch02      node004
>> ibswitch02      node005
>> ibswitch02      node006
>> ibswitch03      node007
>> ibswitch03      node008
>> ibswitch03      node009
>>
>> in the file "topology.txt"
>>
>> and the following code:
>>
>> library("igraph")
>> topo_data <- read.csv(file="topology.txt",head=FALSE,sep="\t")
>> network_data <-graph.data.frame(topo_data, directed=F)
>> plot(network_data)
>>
>> it takes about 5 seconds for the plot to be drawn with R 3.2.0 on a
>> 12-core 2.67 GHz Xeon X5650 server with no other CPU-intensive processes
>> running.
>>
>> This strikes me as rather slow, particularly as my full network has over
>> 120 components and the plot takes around 50 seconds.
>>
>> Am I doing anything wrong?
>>
>> (I am working over an ssh connection with X forwarding, but plotting to
>> a PDF file on the server does not seem to be faster.)
>>
>> Cheers,
>>
>> Loris
>>
>> --
>> This signature is currently under construction.
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

--
Dr. Loris Bennett (Mr.)
ZEDAT, Freie Universit├Ąt Berlin         Email [hidden email]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: igraph plot slowness

Loris Bennett-2
Loris Bennett <[hidden email]> writes:

> Hi Jim,
>
> jim holtman <[hidden email]> writes:
>
>> Here is what it does locally on my PC:
>>
>>> library("igraph")
>>>  topo_data <- read.table(text = "ibcore01        ibswitch01
>> +  ibcore01        ibswitch02
>> +  ibcore01        ibswitch03
>> +  ibcore02        ibswitch01
>> +  ibcore02        ibswitch02
>> +  ibcore02        ibswitch03
>> +  ibswitch01      node001
>> +  ibswitch01      node002
>> +  ibswitch01      node003
>> +  ibswitch02      node004
>> +  ibswitch02      node005
>> +  ibswitch02      node006
>> +  ibswitch03      node007
>> +  ibswitch03      node008
>> +  ibswitch03      node009" ,head=FALSE)
>>>  system.time({
>> +  network_data <-graph.data.frame(topo_data, directed=F)
>> +  plot(network_data)
>> + })
>>    user  system elapsed
>>    0.01    0.01    0.03
>>>
>>>
>>
>> Does not seem too slow.  Creating a PDF file takes a little longer:
>>
>>> library("igraph")
>>>  topo_data <- read.table(text = "ibcore01        ibswitch01
>> +  ibcore01        ibswitch02
>> +  ibcore01        ibswitch03
>> +  ibcore02        ibswitch01
>> +  ibcore02        ibswitch02
>> +  ibcore02        ibswitch03
>> +  ibswitch01      node001
>> +  ibswitch01      node002
>> +  ibswitch01      node003
>> +  ibswitch02      node004
>> +  ibswitch02      node005
>> +  ibswitch02      node006
>> +  ibswitch03      node007
>> +  ibswitch03      node008
>> +  ibswitch03      node009" ,head=FALSE)
>>>  system.time({
>> +  network_data <-graph.data.frame(topo_data, directed=F)
>> +  pdf('test.pdf')
>> +  plot(network_data)
>> +  dev.off()
>> + })
>>    user  system elapsed
>>    0.09    0.00    0.16
>>
>> The PDF file is attached.  So maybe it is something with your remote
>> connection.
>
> You're right.  Running locally even the plot of complete network takes
> less than 0.2 seconds via the X11 device.  I'll have a closer look at
> the connection.
>
> Thanks,
>
> Loris

I found the solution here:

http://www.r-bloggers.com/slow-r-graphics-via-ssh/

namely calling

X11.options(type="Xlib")

in the remote R session.

Cheers,

Loris

--
This signature is currently under construction.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.