graph_draw not mapping integer props correctly
I'm not sure if this is intended behaviour of graph_tool.draw.graph_draw, but it seems erroneous. If I add an edge property as an 'int' with some values (e.g. 1 and 11) they are colormapped differently as opposed to 'float' with the same values.
Perhaps conversion to (normalized) floats is essential for the mapping to work out, but I feel this is something that should be covered behind the scenes. For instance, if you would like to map according to vertex degree, you would have to convert your property to float first, because it would otherwise be mapped with bogus colors (they seemingly do something, which could be even worse).
Bug reports:
- I'm running graph_tool 2.25 on Ubuntu 16.04, Python 3.6.2, not manually compiled.
- Do you observe the problem with the current git version?
- I see no relevant changes in the files and cannot build from source sadly.
import numpy as np
import graph_tool.all as gt
from graph_tool.draw import graph_draw
g = gt.Graph()
# Edge prop
adj = g.new_ep('int') # CHANGE TO FLOAT FOR CORRECT BEHAVIOUR
g.ep['adj'] = adj
# Populate
a = np.array([[0, 1, 11], [1, 0, 1]])
g.add_edge_list(a, eprops=[adj])
# Names
vnames = g.new_vp('string', vals=['A', 'B'])
g.vp['vnames'] = vnames
# Draw
graph_draw(g,edge_color=adj, vertex_text=vnames, edge_pen_width=6.0, output='test_int.png')