`graph_draw` accepts either a file name or a file object. I would investigate passing a BytesIO (https://docs.python.org/3/library/io.html#io.BytesIO) object to the `output` parameter of  `graph_draw` (instead of a filename).

 

You can then read from the BytesIO object (for instance, to a numpy array) and then pass it to OpenCV. This should avoid disk I/O entirely.

 

Joe

 

From: graph-tool <graph-tool-bounces@skewed.de> On Behalf Of Lex Fridman
Sent: 21 April 2020 00:14
To: graph-tool@skewed.de
Subject: [graph-tool] Fast way to draw moving graphs in video

 

Hi all,

 

I'm currently drawing a graph snapshot to an image file, then loading it back in and writing that image to a video with OpenCV. This I/O process is a big bottleneck. Does anyone know a faster way to do this? Are there ways in graph-tool to speed this up or skip the I/O alltogether?

 

- Lex