Hello,
I'm using graph-tool to create demonstrations of how a few graph
coloring algorithms work. To do so, I'm creating snapshot images
at each step of the coloring process.
While pinning the vertices' positions is trivial, I couldn't find a
nice solution to "pin the colors": every time a new color is used,
the normalization process picks new colors for all vertices,
giving the false impression that the algorithm has changed them.
The code sample below probably explains the problem better: it
creates files ex-vcolor-{0,1,2}.png showing that the vertex color
changes:
g = Graph(directed=False)
v_color = g.new_vertex_property("int")
g.add_vertex(3)
g.add_edge_list([(0,1),(1,2),(2,0)])
pos = sfdp_layout(g)
for v in g.vertices():
v_color[v] = int(v)
graph_draw(g, vertex_fill_color=v_color, pos=pos,
output="ex-vcolor-" + str(int(v)) + ".png")
What I would like to have is: use the normalization process only
once for n colors (to pick "spaced" colors) and then stick to them
even when just a few are used in the graph being draw. Is this
possible? Any ideas?
Thanks,
Leonardo
PS. And thanks a lot for graph-tool! It is a real time saver :-)