Sorry for disturbing again, but I’m trying to draw a graph (with graphviz) with labels on vertices and on edges. I saw in the documentation that vprops and eprops are Python attributes with values that are dictionaries containing key-value pairs, where key is a graphviz attribute and value is either a string or a property map. So I tried the following: graphviz_draw(g, vcolor=typev, vprops={label: labelv}, eprops={label: labele}, output=fname+".pdf ») where label is a graphviz property (as explained in http://www.graphviz.org/doc/info/attrs.html#d:label <http://www.graphviz.org/doc/info/attrs.html#d:label>) and labelv and labele are property maps defined as labelv = g.new_vertex_property("string") labele = g.new_edge_property("string ») This doesn’t work and I get the error message Traceback (most recent call last): File "build-graph.py", line 459, in <module> graphviz_draw(g, vcolor=typev, vprops={label: labelv}, eprops={label: labele}, output=fname+".pdf") NameError: name 'label' is not defined But label is indeed a graphviz property, no doubt upon that. What am I doing wrong? Thanks in advance Yannis -- ------------------------------------------------------- Yannis Haralambous Professor Institut Mines-Télécom, Télécom Bretagne Computer Science Department UMR CNRS 6285 Lab-STICC Technopôle Brest Iroise CS 83818, 29238 Brest Cedex 3, France Email: yannis.haralambous@telecom-bretagne.eu <mailto:yannis.haralambous@telecom-bretagne.eu> Internet: http://perso.telecom-bretagne.eu/yannisharalambous/ <http://omega.enstb.org/yannis> ICBM address: 48°21'31.57"N 4°34'16.76"W Twitter: y_haralambous ------------------------------------------------------- ...the ball I threw while playing in the park has not yet reached the ground (Dylan Thomas) Es gab eine Zeit, wo ich nur ungern über Schubert sprechen, nur Nächtens den Bäumen und Sternen von ihm vorerzählen mögen. (Robert Schumann)
Hi Yannis, As the error message states, that is happening within your code at line 459. It isn't going down to graph_tool or graphviz. And it is a python NameError for 'label', so you're simply using a name 'label' that is not defined. You can't define a dictionary using as argument something that is not defined. In this case it is your dictionary definition that should have quoted the name so it becomes a string. Try this instead: graphviz_draw(g, vcolor=typev, vprops={"label": labelv}, eprops={"label": labele}, output=fname+".pdf") Good luck, ale On Thu, Oct 15, 2015 at 8:46 AM, Yannis Haralambous <yannis1962@gmail.com> wrote:
Sorry for disturbing again, but I’m trying to draw a graph (with graphviz) with labels on vertices and on edges. I saw in the documentation that vprops and eprops are Python attributes with values that are dictionaries containing key-value pairs, where key is a graphviz attribute and value is either a string or a property map.
So I tried the following:
*graphviz_draw(g, vcolor=typev, vprops={label: labelv}, eprops={label: labele}, output=fname+".pdf »)*
where label is a graphviz property (as explained in http://www.graphviz.org/doc/info/attrs.html#d:label) and labelv and labele are property maps defined as
*labelv = g.new_vertex_property("string")labele = g.new_edge_property("string »)*
This doesn’t work and I get the error message
*Traceback (most recent call last):* * File "build-graph.py", line 459, in <module>* * graphviz_draw(g, vcolor=typev, vprops={label: labelv}, eprops={label: labele}, output=fname+".pdf")* *NameError: name 'label' is not defined*
But label is indeed a graphviz property, no doubt upon that. What am I doing wrong?
Thanks in advance
Yannis
-- ------------------------------------------------------- Yannis Haralambous Professor Institut Mines-Télécom, Télécom Bretagne Computer Science Department UMR CNRS 6285 Lab-STICC Technopôle Brest Iroise CS 83818, 29238 Brest Cedex 3, France Email: yannis.haralambous@telecom-bretagne.eu Internet: http://perso.telecom-bretagne.eu/yannisharalambous/ <http://omega.enstb.org/yannis> ICBM address: 48°21'31.57"N 4°34'16.76"W Twitter: y_haralambous ------------------------------------------------------- ...the ball I threw while playing in the park has not yet reached the ground (Dylan Thomas)
Es gab eine Zeit, wo ich nur ungern über Schubert sprechen, nur Nächtens den Bäumen und Sternen von ihm vorerzählen mögen. (Robert Schumann)
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
participants (2)
-
Alexandre Hannud Abdo -
Yannis Haralambous