I would like to combine an existing vertex property (called labelv and of type 
string) and the vertex index to obtain a new vertex property, to use inside 
graphviz_draw. Here is what I wrote:

mylabel = g.new_vertex_property("string")
for v in g.vertices():
        g.vp['mylabel'][v] = str(g.vp['labelv'][v])+" 
("+str(g.vertex_index[v])+")"

graphviz_draw(g, vcolor=typev, gprops={"scalexy": "scalexy"}, \
vprops={"xlabel": mylabel, "fontsize": 6, "fixedsize": True, \
"labelloc": "t"}, eprops={"label": labele, "fontsize": 4, \
"dir": "forward"}, output=fname+".pdf »)

But it doens’t work. (I get the error message:

Traceback (most recent call last):
  File "build-graph.py", line 380, in <module>
    g.vp['mylabel'][v] = str(g.vp['labelv'][v])+" ("+str(g.vertex_index[v])+")"
  File "/usr/local/lib/python2.7/site-packages/graph_tool/__init__.py", line 
1346, in __getitem__
    return self.properties[(self.t, key)]
KeyError: ('v', 'mylabel’)

Could you tell me what I’m doing wrong?

Thanks!


-- 
-------------------------------------------------------
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: [email protected]
Internet: http://perso.telecom-bretagne.eu/yannisharalambous/
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
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to