Recently I've committed quite a few patches to the igraph trunk that adapts igraph's Python interface for the API-incompatible changes introduced between Python 2.x and Python 3. Currently, all the 222 test cases pass both in Python 2.6 and Python 3.1, although there might be a few edge cases (especially around UTF-8 encoding issues and GraphML support) that may require further work.
$ python3.1 -m igraph.test.__init__
................................................................
................................................................
................................................................
..............................
----------------------------------------------------------------
Ran 222 tests in 1.802s
OK
Therefore, I'm happy to announce that python-igraph will officially support Python 3 starting from the next major release; that is, 0.6. If you can't wait till the next release and would like to take it for a test drive, you can grab the nightly builds from Google Code and compile them for yourself.
- Published:
- Nov 16, 2010
- Categories:
-
- Comments:
Just learned today that there's a neat function called __git_ps1 in the official bash completion file for Git (usually named as git-completion.bash), which enables one to display the current Git branch in the shell prompt if the current directory is a Git repository. Just put the following somewhere in your bash prompt:
$(__git_ps1 "(%s)")
Make sure that you use single quotes when you set the bash prompt (e.g., export PS1='...' instead of export PS1="...") to ensure that the command is executed every time the prompt is displayed.
You may also use specific environment variables to tweak the behaviour of __git_ps1:
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWSTASHSTATE=true
- Published:
- Sep 16, 2010
- Categories:
-
- Comments:
This entry presents an add-on to the Python package of igraph that enables one to create nifty animations featuring igraph graphs with ease. At the moment, the add-on requires MEncoder to encode consecutive frames to an AVI video file, but it is easy to add support for other video encoders like FFMpeg or even to use PyMedia to encode the video stream directly without saving the individual frames to disk first. I will also show two usage examples, one for the visualisation of the GraphOpt layout algorithm and the other for the simulation of a simple SIR (susceptible-infected-recovered) epidemic model.
Read more »
- Published:
- Sep 13, 2010
- Categories:
-
- Comments:
An interesting question popped up on the igraph-help mailing list the other day: someone asked whether it is possible to plot an igraph graph on top of a Matplotlib plot. Matplotlib is definitely the de facto 2D plotting library in Python, so I thought it would be nice if there would be a way to wire them together somehow.
igraph uses Cairo as a plotting backend. If you dive into the plotting internals of igraph, you will see that every plottable object has a method called __plot__, which is called when the object has to be plotted on a Cairo surface. (The plotting code has undergone major refactoring in the last few weeks, therefore things are likely to change in igraph 0.6, but the __plot__ method will be kept for sake of compatibility anyway). For instance, Graph.__plot__ is called with a Cairo context ctx, a bounding box bbox in which the graph has to be drawn, and a palette that is used occasionally to resolve numeric color indices to RGB triplets. This means that I would only have to extract the Cairo context that Matplotlib uses to draw the figures and pass it on to Graph.__plot__ somehow.
Read more »
- Published:
- Jul 02, 2010
- Categories:
-
- Comments:
Maximal clique finding has been part of igraph for quite a long time (the first commit of this algorithm was well back in 2007 IIRC), but out of sheer laziness I simply implemented it as a search for maximal independent vertex sets on the complementary graph. As Drew Conway pointed it out in one of his SNA talks, this is a terribly slow approach for sparse graphs as it takes ages to build the complementary graph. The implementation of the Bron-Kerbosch algorithm in last September (see this commit in Launchpad) speeded up things big time, and at that point I thought this is pretty much as good as it gets - but I was wrong. There was still plenty of space for improvement.
Read more »
- Published:
- Mar 28, 2010
- Categories:
-
- Comments:
It looks like the change from 32-bit OS X Leopard to 64-bit OS X Snow Leopard won't be as smooth as I had originally expected. Although I have to admit that the OS X developers did a very good job in making the change as smooth as possible for ordinary users (insert the DVD, start the installer, grab a coffee, wait, reboot, rejoice), but from the developers' point of view, there are a few unexpected glitches.
The first is that Python was upgraded to a 64-bit version of the 2.6.1 release. This means that all the Python extensions I used that have parts written in C have to be recompiled from scratch for the 64-bit version. Not a big deal - as long as you don't use any extensions that depend on 32-bit third party libraries. One example is Syck, a YAML parser written in C. I used to install Syck from Fink, but Fink only supplies a 32-bit version, not a 64-bit one, so for the time being I am stuck with a 32-bit version... which means that I have to run Python in 32-bit mode. Luckily, there are at least two ways to switch back to the 32-bit implementation. One is to change the corresponding setting permanently:
$ defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
The other possibility is an environment variable called VERSIONER_PYTHON_PREFER_32_BIT which should be set to either yes or no.
Another catch lies in gcc which also produces 64-bit code by default. This means that it won't be able to link to a static or dynamic library compiled earlier with Leopard in 32-bit mode; either the library has to be recompiled or gcc should be instructed to produce 32-bit code:
$ gcc -arch i386 ...the rest is the same
- Published:
- Sep 28, 2009
- Categories:
-
- Comments:
$ export GREP_OPTIONS='--color=auto'
The best thing since sliced bread. (Put it into your .profile of course).
The highlight colour can also be adjusted by tweaking GREP_COLOR using standard SGR ANSI codes - my personal choice is export GREP_COLOR='30;43' which gives an appearance resembling a yellow highlighter pen.
Tagged: grep, Linux, os x
- Published:
- Aug 28, 2009
- Categories:
-
- Comments:
PithHelmet is a great software for those who are at least as annoyed by advertisements and silly moving Flash banners and such as me. However, it does not work with Safari 3.1 and above at the time I write this: Safari claims that this plugin is untested and refuses to load it. The good thing is that changing a single byte in the appropriate config file is enough to deceive Safari and make it load PithHelmet again. The steps to salvation are as follows:
Read more »
Tagged: hack, os x, pithhelmet, safari, Software
- Published:
- Apr 18, 2008
- Categories:
-
- Comments:
Amint már írtam régebben, van az OS X Leopardnak és az Office 2008-nak egy kis lerendeznivaló vitája egymással. Nevezetesen: magyar kiosztást használva a Word 2008 kurzora nemes egyszerűséggel felfelé mozog, ha leütöm a hosszú ó betűt, elég nehézkessé téve így bármiféle magyar dokumentum írását (hosszú ó betű clipboardra TextEdit-ből, majd paste-elés Wordben, feltéve, ha közben másra nem használtam a clipboardot). A jó hír az, hogy Gaba Hungarian-PRG kiosztása segítségével a probléma orvosolható. Az egyetlen zavaró tényező az maradt, hogy Gaba kiosztása visszarendezi az Y-t és a Z-t az angol billentyűzeten megszokott helyére, értelmetlenné téve ezzel a magyar billentyűzet megszokásával töltött hosszú éveket ;) Így hát fogtam a kiosztást, Ukelele segítségével megcseréltem ismét a fentebb említett két billentyűt, és csodák csodája, működik Word-ben is rendesen a hosszú ó. Öröm és boldogság.
Read more »
Tagged: microsoft, os x, ukelele, word
- Published:
- Feb 01, 2008
- Categories:
-
- Comments:
By removing/hiding the Advanced Options panel of the Add Printer dialog, Apple posed me a challenge when I tried to install a shared Windows printer used in my department. Basically, the damn thing (or more precisely its server) did not show up among the shares in my workgroup. Luckily, there's a full-fledged CUPS (Common Unix Printing System) deep beneath, so I succeeded by typing localhost:631 in Safari to reach the CUPS admin area where I was able to add it manually. Another possibility is right-clicking on the toolbar of the Add Printer dialog box and add the Advanced button - it takes a while until it initializes, but after that, it provides almost the same functionality as the CUPS admin area.
Tagged: cups, os x, printing, samba, windows
- Published:
- Feb 01, 2008
- Categories:
-
- Comments: