draw_hierarchy

Contents

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:
stateNestedBlockState

Nested block state to be drawn.

posVertexPropertyMap (optional, default: None)

If supplied, this specifies a vertex property map with the positions of the vertices in the layout.

layoutstr or VertexPropertyMap (optional, default: "radial")

If layout == "radial" radial_tree_layout() will be used. If layout == "sfdp", the hierarchy tree will be positioned using sfdp_layout(). If layout == "bipartite" a bipartite layout will be used. If instead a VertexPropertyMap is provided, it must correspond to the position of the hierarchy tree.

betafloat (optional, default: .8)

Edge bundling strength.

node_weightVertexPropertyMap (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. See graph_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. See graph_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. See graph_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. See graph_draw() for details.

subsample_edgesint or list of Edge instances (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_orderstr or None or VertexPropertyMap (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 a VertexPropertyMap is provided, its value will be used for the relative ordering.

deg_sizebool (optional, default: True)

If True, the (total) node degrees will be used for the default vertex sizes..

vsize_scalefloat (optional, default: 1.)

Multiplicative factor for the default vertex sizes.

hsize_scalefloat (optional, default: 1.)

Multiplicative factor for the default sizes of the hierarchy nodes.

hshortcutsint (optional, default: 0)

Include shortcuts to the number of upper layers in the hierarchy determined by this parameter.

hideint (optional, default: 0)

Hide upper levels of the hierarchy.

bip_aspectfloat (optional, default: 1.)

If layout == "bipartite", this will define the aspect ratio of layout.

empty_branchesbool (optional, default: False)

If empty_branches == False, dangling branches at the upper layers will be pruned.

vertex_*VertexPropertyMap or arbitrary types (optional, default: None)

Parameters following the pattern vertex_<prop-name> specify the vertex property with name <prop-name>, as an alternative to the vprops parameter. See graph_draw() for details.

edge_*EdgePropertyMap or arbitrary types (optional, default: None)

Parameters following the pattern edge_<prop-name> specify the edge property with name <prop-name>, as an alternative to the eprops parameter. See graph_draw() for details.

hvertex_*VertexPropertyMap or arbitrary types (optional, default: None)

Parameters following the pattern hvertex_<prop-name> specify the vertex property with name <prop-name>, as an alternative to the hvprops parameter. See graph_draw() for details.

hedge_*EdgePropertyMap or arbitrary types (optional, default: None)

Parameters following the pattern hedge_<prop-name> specify the edge property with name <prop-name>, as an alternative to the heprops parameter. See graph_draw() for details.

**kwargs

All remaining keyword arguments will be passed to the graph_draw() function.

Returns:
posVertexPropertyMap

This is a vertex property map with the positions of the vertices in the layout.

tGraph

This is a the hierarchy tree used in the layout.

tposVertexPropertyMap

This is a vertex property map with the positions of the hierarchy tree in the layout.

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")
(...)
../_images/celegansneural_nested_mdl.png

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.#