Drawing float values on the vertices

Dear Tiago,

I am trying to draw float values associated with vertices in a graph as
vertex texts. However, I get a peculiar output (file attached). My code is
given below:

import graph_tool.all as gt
import numpy as np

g = gt.collection.data['karate']

value = g.new_vertex_property('float')

for v in g.vertices():
    value[v] = np.random.choice([0.5, 0.8])

gt.graph_draw(g, vertex_text = value, output = 'test.pdf')

How can I draw the float values as such?

Thank you
Snehal

attachment.html (1019 Bytes)

test.pdf (17 KB)

You should create a string property map and convert the float values using
whatever format you want.

Graph-tool defaults to a hexadecimal floating point representation, which
allows for perfect storage, but is not the most readable.

Best,
Tiago