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)
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-33-2279357ad581> in <module>() ----> 1 graph_draw(g, vertex_text=node_map.keys(), inline=True)
/usr/local/lib/python2.7/site-packages/graph_tool/draw/cairo_draw.pyc in graph_draw(g, pos, vprops, eprops, vorder, eorder, nodesfirst, output_size, fit_view, inline, output, fmt, **kwargs) 928 929 cairo_draw(g, pos, cr, vprops, eprops, vorder, eorder, --> 930 nodesfirst, **kwargs) 931 932 if fmt == "png":
/usr/local/lib/python2.7/site-packages/graph_tool/draw/cairo_draw.pyc in cairo_draw(g, pos, cr, vprops, eprops, vorder, eorder, nodesfirst, vcmap, ecmap, loop_angle, parallel_distance, fit_view, **kwargs) 512 libgraph_tool_draw.cairo_draw(g._Graph__graph, _prop("v", g, pos), 513 _prop("v", g, vorder), _prop("e", g, eorder), --> 514 nodesfirst, vattrs, eattrs, vdefs, edefs, cr) 515 cr.restore() 516
TypeError: No registered converter was able to produce a C++ rvalue of type std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > from this Python object of type list
-- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 15.11.2014 21:54, charlie wrote:
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
On 16 Nov 2014, at 00:18, Tiago de Paula Peixoto tiago@skewed.de wrote:
On 15.11.2014 21:54, charlie wrote:
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
-- Tiago de Paula Peixoto <tiago@skewed.de mailto:tiago@skewed.de>
graph-tool mailing list graph-tool@skewed.de mailto:graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool http://lists.skewed.de/mailman/listinfo/graph-tool