1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

pickle?

Posted by Chris on Feb 04, 2008

I'm using the graph and colors libraries, as well as the web library to parse xml files and construct graph nodes. The graph I'm working with is quite large, and I was hoping to pickle the graph object so I wouldn't have to parse the xml and construct the object each time I run the application. I receive an error about not being able to pickle objective c objects or something like that?

Can anybody think of a way around this?


 
Posted by Tom De Smedt on Feb 11, 2008

That's because the Graph object stores colors, textpaths, etc. which are Objective-C objects.

An easy solution would be to simply cache the data you're loading into the graph (the nodes and the edges). You could store it in a text file, or a pickled dictionary.

Loading a graph with many nodes and edges will still take some time, as the layout needs to be recalculated.

When update() or solve() is called the layout manager will adjust the vx and vy properties of each node. You could experiment with caching the calculated vx and vy of the nodes.