graph-gool GraphView object for directed graphs
The Code
g = load_graph("mynet.xml")
gc = GraphView(g, vfilt=label_largest_component(g, directed=False))
indeg = gc.degree_property_map("in")
indeg.a = np.sqrt(indeg.a)+2
graph_draw(gc, vertex_size = indeg, vertex_fill_color=indeg, pos = sfdp_layout(gc),
vcmap=plt.cm.gist_heat, output_size=(1200, 1200), output="gc.pdf")
Graph Description
g
<Graph object, directed, with 9895 vertices and 16713 edges at 0x12dc1f450>
gc
<GraphView object, directed, with 9099 vertices and 16201 edges, edges filtered by (<PropertyMap object with key type 'Edge' and value type 'bool', for Graph 0x10b98b510, at 0x12e778350, with values:
[1 1 1 ..., 1 1 1]>, False), vertices filtered by (<PropertyMap object with key type 'Vertex' and value type 'bool', for Graph 0x12dc1f450, at 0x12e778510, with values:
[1 1 1 ..., 1 0 1]>, False) at 0x10b98b510>
Also, len(indeg.a)
is 9895.
The Error
## -- End pasted text --
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-253-b4d857d9b24b> in <module>()
2 indeg.a = np.sqrt(indeg.a)+2
3 graph_draw(gc, vertex_size = indeg, vertex_fill_color=indeg, pos = sfdp_layout(gc),
----> 4 vcmap=plt.cm.gist_heat, output_size=(1200, 1200), output="gc.pdf")
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/draw/cairo_draw.pyc in graph_draw(g, pos, vprops, eprops, vorder, eorder, nodesfirst, output_size, fit_view, inline, mplfig, output, fmt, **kwargs)
1001 vprops.get("font_size",
1002 _vdefaults["font_size"]),
-> 1003 cr)
1004 fit_view = False
1005 else:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/draw/cairo_draw.pyc in fit_to_view(g, pos, geometry, size, pen_width, M, text, font_family, font_size, cr)
1175 x_range, y_range, x_delta, y_delta = get_bb(g, pos, size, pen_width,
1176 1, text, font_family,
-> 1177 font_size, cr)
1178 dx = (x_range[1] - x_range[0])
1179 dy = (y_range[1] - y_range[0])
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/draw/cairo_draw.pyc in get_bb(g, pos, size, pen_width, size_scale, text, font_family, font_size, cr)
1148 x_range = [pos_x.fa.min(), pos_x.fa.max()]
1149 y_range = [pos_y.fa.min(), pos_y.fa.max()]
-> 1150 x_delta = [x_range[0] - (pos_x.fa - delta).min(),
1151 (pos_x.fa + delta).max() - x_range[1]]
1152 y_delta = [y_range[0] - (pos_y.fa - delta).min(),
ValueError: operands could not be broadcast together with shapes (9895,) (9099,)