graph_tool.draw#

This module contains functions for graph drawing and layout.

Layout algorithms#

sfdp_layout

Obtain the SFDP spring-block layout of the graph.

hfd_layout

Obtain a hierarchical force-directed (HFD) layout of the graph.

fruchterman_reingold_layout

Calculate the Fruchterman-Reingold spring-block layout of the graph.

arf_layout

Calculate the ARF spring-block layout of the graph.

radial_tree_layout

Computes a radial layout of the graph according to the shortest-path tree centered at the root vertex.

tree_layout

Calculate a tidy layered layout of a tree or a forest.

layered_layout

Calculate a layered (hierarchical) layout of a directed graph.

kamada_kawai_layout

Calculate the Kamada-Kawai spring layout of a connected graph.

mds_layout

Calculate a layout by classical multidimensional scaling of the graph distances.

stress_layout

Calculate a layout of the graph by stress majorization.

drl_layout

Calculate a force-directed layout with the DrL (OpenOrd) algorithm.

umap_layout

Calculate a layout of the graph with the UMAP algorithm.

gursoy_atun_layout

Calculate a layout of the graph with the Gursoy-Atun self-organizing map.

forceatlas2_layout

Calculate a force-directed layout of the graph with the ForceAtlas2 algorithm.

graphopt_layout

Calculate a force-directed layout of the graph with the GraphOpt model.

davidson_harel_layout

Calculate a layout of the graph by simulated annealing with the Davidson-Harel energy.

lgl_layout

Calculate a layout of the graph with the Large Graph Layout (LGL) algorithm.

gem_layout

Calculate a layout of the graph with the GEM algorithm.

spectral_layout

Calculate a layout of the graph from the eigenvectors of its Laplacian.

circle_layout

Place the vertices on a circle.

star_layout

Place one vertex at the center and the others on a circle around it.

shell_layout

Place the vertices on concentric circles.

spiral_layout

Place the vertices along a spiral.

grid_layout

Place the vertices on a regular grid.

sphere_layout

Place the vertices on a sphere, approximately evenly spaced.

planar_layout

Performs a canonical layout of a planar graph.

random_layout

Performs a random layout of the graph.

HFDState

State of a hierarchical force-directed (HFD) layout of a graph.

Layout transformations#

align_layout

Align a layout with the coordinate axes.

pack_layout

Pack the layouts of the connected components (or of groups of vertices) side by side.

Graph drawing#

graph_draw

Draw a graph to screen or to a file using cairo.

draw_hierarchy

Draw a nested block model state in a circular or bipartite hierarchy layout with edge bundling.

prop_to_size

Convert property map values to be more useful as a vertex size, or edge width.

get_hierarchy_control_points

Return the Bézier spline control points for the edges in g, given the hierarchical structure encoded in graph t.

Low-level graph drawing#

cairo_draw

Draw a graph to a cairo.Context.

interactive_window

Display an interactive GTK+ window containing the given graph.

GraphWidget

Interactive GTK+ widget displaying a given graph.

GraphWindow

Interactive GTK+ window containing a GraphWidget.

GraphArtist

matplotlib.artist.Artist specialization that draws Graph instances in a matplotlib figure.