To mix business with pleasure I wrote a small app that excercises my bfs implementation. The basic idea is to get related items from Amazon up to a given depth, starting with a keyword. The result is a graphviz DOT file, which is easily exported to other formats. E.g.
$ python test_amazon.py 'boost graph library' 3 BGL.dot
The results are
here (png) (or
here if you want the DOT file):
Prerequisites:
-
PyAmazon module from Mark Pilgrim. You will need an Amazon Associate account (easy to get). Once you get a key you can basically hardcode it into PyAmazon's amazon.py file, like this: LICENSE_KEY = 'your_license_key_here'
-
pygraphlib. While my library should eventually be a viable alternative to this, pygraphlib is a pretty good minimalistic library, and I could not get DOT output without it at this point
-
graphviz, if you want to view the DOT file.
- my lib, in particular the bfs.py lib file and the driver test_amazon.py
As you can tell by the length of this program, this is the kind of thing Python shines at :).