draw_hierarchy#
- graph_tool.draw.draw_hierarchy(state, pos=None, layout='radial', beta=0.8, node_weight=None, vprops=None, eprops=None, hvprops=None, heprops=None, subsample_edges=None, rel_order='degree', deg_size=True, vsize_scale=1, hsize_scale=1, hshortcuts=0, hide=0, bip_aspect=1.0, empty_branches=False, **kwargs)[source]#
Draw a nested block model state in a circular hierarchy layout with edge bundling.
- Parameters:
- state
NestedBlockState Nested block state to be drawn.
- pos
VertexPropertyMap(optional, default:None) If supplied, this specifies a vertex property map with the positions of the vertices in the layout.
- layout
strorVertexPropertyMap(optional, default:"radial") If
layout == "radial"radial_tree_layout()will be used. Iflayout == "sfdp", the hierarchy tree will be positioned usingsfdp_layout(). Iflayout == "bipartite"a bipartite layout will be used. If instead aVertexPropertyMapis provided, it must correspond to the position of the hierarchy tree.- beta
float(optional, default:.8) Edge bundling strength.
- node_weight
VertexPropertyMap(optional, default:None) If provided, this specifies a vertex property map with the relative angular section that each vertex occupies. This value is ignored if
layout != "radial".- vpropsdict (optional, default:
None) Dictionary with the vertex properties. Individual properties may also be given via the
vertex_<prop-name>parameters, where<prop-name>is the name of the property. Seegraph_draw()for details.- epropsdict (optional, default:
None) Dictionary with the edge properties. Individual properties may also be given via the
edge_<prop-name>parameters, where<prop-name>is the name of the property. Seegraph_draw()for details.- hvpropsdict (optional, default:
None) Dictionary with the vertex properties for the hierarchy tree. Individual properties may also be given via the
hvertex_<prop-name>parameters, where<prop-name>is the name of the property. Seegraph_draw()for details.- hepropsdict (optional, default:
None) Dictionary with the edge properties for the hierarchy tree. Individual properties may also be given via the
hedge_<prop-name>parameters, where<prop-name>is the name of the property. Seegraph_draw()for details.- subsample_edges
intor list ofEdgeinstances (optional, default:None) If provided, only this number of random edges will be drawn. If the value is a list, it should include the edges that are to be drawn.
- rel_order
strorNoneorVertexPropertyMap(optional, default:"degree") If
degree, the vertices will be ordered according to degree inside each group, and the relative ordering of the hierarchy branches. If instead aVertexPropertyMapis provided, its value will be used for the relative ordering.- deg_size
bool(optional, default:True) If
True, the (total) node degrees will be used for the default vertex sizes..- vsize_scale
float(optional, default:1.) Multiplicative factor for the default vertex sizes.
- hsize_scale
float(optional, default:1.) Multiplicative factor for the default sizes of the hierarchy nodes.
- hshortcuts
int(optional, default:0) Include shortcuts to the number of upper layers in the hierarchy determined by this parameter.
- hide
int(optional, default:0) Hide upper levels of the hierarchy.
- bip_aspect
float(optional, default:1.) If
layout == "bipartite", this will define the aspect ratio of layout.- empty_branches
bool(optional, default:False) If
empty_branches == False, dangling branches at the upper layers will be pruned.- vertex_*
VertexPropertyMapor arbitrary types (optional, default:None) Parameters following the pattern
vertex_<prop-name>specify the vertex property with name<prop-name>, as an alternative to thevpropsparameter. Seegraph_draw()for details.- edge_*
EdgePropertyMapor arbitrary types (optional, default:None) Parameters following the pattern
edge_<prop-name>specify the edge property with name<prop-name>, as an alternative to theepropsparameter. Seegraph_draw()for details.- hvertex_*
VertexPropertyMapor arbitrary types (optional, default:None) Parameters following the pattern
hvertex_<prop-name>specify the vertex property with name<prop-name>, as an alternative to thehvpropsparameter. Seegraph_draw()for details.- hedge_*
EdgePropertyMapor arbitrary types (optional, default:None) Parameters following the pattern
hedge_<prop-name>specify the edge property with name<prop-name>, as an alternative to thehepropsparameter. Seegraph_draw()for details.- **kwargs
All remaining keyword arguments will be passed to the
graph_draw()function.
- state
- Returns:
- pos
VertexPropertyMap This is a vertex property map with the positions of the vertices in the layout.
- t
Graph This is a the hierarchy tree used in the layout.
- tpos
VertexPropertyMap This is a vertex property map with the positions of the hierarchy tree in the layout.
- pos
References
[holten-hierarchical-2006]Holten, D. “Hierarchical Edge Bundles: Visualization of Adjacency Relations in Hierarchical Data.”, IEEE Transactions on Visualization and Computer Graphics 12, no. 5, 741–748 (2006). DOI: 10.1109/TVCG.2006.147 [sci-hub, @tor]
Examples
>>> g = gt.collection.data["celegansneural"] >>> state = gt.minimize_nested_blockmodel_dl(g) >>> gt.draw_hierarchy(state, output="celegansneural_nested_mdl.pdf") (...)
Hierarchical block partition of the C. elegans neural network, which minimizes the description length of the network according to the nested (degree-corrected) stochastic blockmodel.#