graph_draw

Hi,

I've just installed graph_tool on my Mac via Homebrew, more-or-less
according to the walkthrough recommended on the graph-tool installation page
(https://gist.github.com/openp2pdesign/8864593).

When I try to use the graph_draw function I get an error.

Please help! Thanks.

Here is my command and the error traceback:

graph_draw(g, vertex_text=node_map.keys(), inline=True)

Is node_map a dict? It looks like you are passing an arbitrary list of
values as vertex_text, but it only accepts a single string or a
PropertyMap. Please take a closer look at the documentation and the
examples therein. If you want to have different texts in each node you
should do something like:

    text = g.new_vertex_property("string")
    text[g.vertex(0)] = "foo"
    text[g.vertex(1)] = "bar"
    ...
    graph_draw(g, vertex_text=text)

Best,
Tiago

Hi,

Thanks for the reply. You are right, I was trying to pass in a list. I had another look at the docs after I made the post and tried to delete it when I realised what I’d done, but I guess it had already gone out to the mailing list. Sorry about that.

Cheers,

Charlie

attachment.html (18.2 KB)