I can't reproduce this. The script above works just fine for me.
What version of graph-tool are you using?
Latest 2.2.35. Boost issue? Here’s what Macports says: $ sudo port info py-graph-tool boost py-graph-tool @2.2.35 (python, science) Sub-ports: py27-graph-tool, py34-graph-tool Description: graph-tool is an efficient python module for manipulation and statistical analysis of graphs. The internal data structures and most algorithms are implemented in C++ with the Boost Graph Library. Homepage: http://graph-tool.skewed.de Library Dependencies: py27-graph-tool Platforms: darwin License: GPL-3 Maintainers: tiago@skewed.de, mmoll@macports.org -- boost @1.56.0_1 (devel) Variants: debug, [+]no_single, [+]no_static, python25, python26, [+]python27, python31, python32, python33, python34, regex_match_extra, universal Description: Boost provides free portable peer-reviewed C++ libraries. The emphasis is on portable libraries which work well with the C++ Standard Library. Homepage: http://www.boost.org Library Dependencies: zlib, expat, bzip2, libiconv, icu, python27 Platforms: darwin License: Boost-1 Maintainers: nomaintainer@macports.org