MongoDB : Geospatial Indexing

Just a short note to let you know that this post has become outdated because MongoDB supports native two dimensional geospatial indexing. More information can be found here.

2 Possible Ways To Speed Up NetworkX (and Python)

I'm in the process of looking for a way to run the shortest path algorithms of NetworkX in a faster way. At this moment I tried psyco and PyPy.

Psyco

Using psyco is really easy. After installing it you only have to write the following two lines.

import psyco psyco.full()

Psyco didn't speedup my shortest path calculations.

If you want to know more about psyco I suggest you to read the documentation.

PyPy

In order to test PyPy I downloaded the latest windows binary and ran my code against PyPy instead of CPython by invoking my script on the command line with pypy.exe.

The startup time is a lot longer for PyPy but if you don't take this startup cost into account then the speedup on my machine is in the range of 10-20% for shortest path routing with NetworkX.

So far my tests. Any suggestions ?

Using NetworkX with Jython

Just a quick note to let you know that the Python graph library NetworkX (version 1.1), which by the way is really good, can be ported to Jython with some minor modifications. Sadly enough you loose some performance in the process.

The two changes I made to get it running where :

  • Because numpy doesn't exist for Jython you can't use the current_flow_closeness_centrality function in current_flow_closeness.py. I moved the import numpy as np statement at the top to the _compute_C function at the bottom.
  • In the __init__.py file under generators I commented from atlas import * out.

In the following weeks I will try to port a small subset off NetworkX to Java or Scala. Hopefully I'll be able to outperform the Jython and CPython version.

Arithmetic, Population, and Energy.

Just watched Dr. Albert A. Bartlett's presentation on "Arithmetic, Population, and Energy." on youtube. It's really good and entertaining. It's in 8 parts and I encourage you to watch them all.


The url of part 1 is : http://www.youtube.com/watch?v=F-QA2rkpBSY