Thanks.. that worked! A small related question: The nodes in my graph are strings and that's why I am using `hashed = True` and `string_vals = True`. How can I use these values as labels for my nodes while drawing the graph? I couldn't find any way to extract these strings to define a new property map for vertex_text.
Thank you Snehal On Wed, Dec 14, 2016 at 4:06 PM, Tiago de Paula Peixoto <[email protected]> wrote: > Hi, > > Indeed there is a bug in the interactive drawing for large graphs. I will > fix this soon. > > In the meantime, a simple workaround is to get the vertex positions > explicitly: > > pos = gt.sfdp_layout(lc) > gt.graph_draw(lc, pos=pos, vertex_size=deg) > > Best, > Tiago > > On 12.12.2016 17:56, Snehal Shekatkar wrote: > > Hello Tiago, > > > > Thanks for the reply. I have attached my full code along with the > necessary > > data file. Can you please try to run it and see what is the problem? > > > > Thank you > > Snehal > > > > On Mon, Dec 12, 2016 at 5:32 PM, Tiago de Paula Peixoto <[email protected] > > <mailto:[email protected]>> wrote: > > > > On 10.12.2016 07:06, Snehal Shekatkar wrote: > > > Hello all, > > > > > > I am encountering a strange error in the usual gt.graph_draw when > I add > > > vertex_size = degree. It works well every time but this time it is > not > > > working. My code: > > > > > > G = gt.Graph(directed = False) > > > G.add_edge_list(edges, hashed = True, string_vals = True) > > > gt.remove_parallel_edges(G) > > > lc = gt.Graph(gt.GraphView(G, vfilt = > gt.label_largest_component(G)), > > prune > > > = True) > > > > > > deg = lc.new_vertex_property('int') > > > for v in lc.vertices(): > > > deg[v] = v.out_degree() > > > > > > print(lc) > > > gt.graph_draw(lc, vertex_size = deg) > > > > > > And I am getting the following error: > > > > > > Traceback (most recent call last): > > > File "/usr/lib/python3/dist-packages/graph_tool/draw/gtk_draw.py", > line > > > 503, in draw > > > self.fit_to_window(ink=False) > > > File "/usr/lib/python3/dist-packages/graph_tool/draw/gtk_draw.py", > line > > > 724, in fit_to_window > > > cr) > > > File "/usr/lib/python3/dist-packages/graph_tool/draw/ > cairo_draw.py", > > line > > > 1319, in fit_to_view > > > font_size, cr) > > > File "/usr/lib/python3/dist-packages/graph_tool/draw/ > cairo_draw.py", > > line > > > 1292, in get_bb > > > x_delta = [x_range[0] - (pos_x.fa - delta).min(), > > > ValueError: operands could not be broadcast together with shapes > (4,) > > (3397,) > > > > > > I have 3397 vertices in my graph. I would greatly appreciate any > help. > > > Thanks in advance. > > > > I can't reproduce this. Please provide a complete, self-contained > program > > that shows the error. (In the example above the list of edges is > missing). > > > > Best, > > Tiago > > > > -- > > Tiago de Paula Peixoto <[email protected] <mailto:[email protected]>> > > > > > > _______________________________________________ > > graph-tool mailing list > > [email protected] <mailto:[email protected]> > > https://lists.skewed.de/mailman/listinfo/graph-tool > > <https://lists.skewed.de/mailman/listinfo/graph-tool> > > > > > > > > > > -- > > > > > > > > > > Snehal Madhukar Shekatkar > > Pune > > India > > > > > > _______________________________________________ > > graph-tool mailing list > > [email protected] > > https://lists.skewed.de/mailman/listinfo/graph-tool > > > > > -- > Tiago de Paula Peixoto <[email protected]> > _______________________________________________ > graph-tool mailing list > [email protected] > https://lists.skewed.de/mailman/listinfo/graph-tool > -- Snehal Madhukar Shekatkar Pune India
_______________________________________________ graph-tool mailing list [email protected] https://lists.skewed.de/mailman/listinfo/graph-tool
