# python-igraph API reference

List of all classes, functions and methods in python-igraph

module documentation

Utility classes for drawing routines.

 Class `BoundingBox` Class representing a bounding box (a rectangular area) that encloses some objects. Class `FakeModule` Fake module that raises an exception for everything Class `Point` Class representing a point on the 2D plane. Class `Rectangle` Class representing a rectangle. Function `autocurve` Calculates curvature values for each of the edges in the graph to make sure that multiple edges are shown properly on a graph plot. Function `calculate_corner_radii` Given a list of points and a desired corner radius, returns a list containing proposed corner radii for each of the points such that it is ensured that the corner radius at a point is never larger than half of the minimum distance between the point and its neighbors. Function `euclidean_distance` Computes the Euclidean distance between points (x1,y1) and (x2,y2). Function `evaluate_cubic_bezier` Evaluates the Bezier curve from point (x0,y0) to (x3,y3) via control points (x1,y1) and (x2,y2) at t. t is typically in the range [0; 1] such that 0 returns (x0, y0) and 1 returns (x3, y3). Function `get_bezier_control_points_for_curved_edge` Helper function that calculates the Bezier control points for a curved edge that goes from (x1, y1) to (x2, y2). Function `intersect_bezier_curve_and_circle` Binary search solver for finding the intersection of a Bezier curve and a circle centered at the curve's end point. Function `str_to_orientation` Tries to interpret a string as an orientation value.
def autocurve(graph, attribute='curved', default=0):

Calculates curvature values for each of the edges in the graph to make sure that multiple edges are shown properly on a graph plot.

This function checks the multiplicity of each edge in the graph and assigns curvature values (numbers between -1 and 1, corresponding to CCW (-1), straight (0) and CW (1) curved edges) to them. The assigned values are either stored in an edge attribute or returned as a list, depending on the value of the attribute argument.

 Parameters graph the graph on which the calculation will be run attribute the name of the edge attribute to save the curvature values to. The default value is curved, which is the name of the edge attribute the default graph plotter checks to decide whether an edge should be curved on the plot or not. If attribute is None, the result will not be stored. default the default curvature for single edges. Zero means that single edges will be straight. If you want single edges to be curved as well, try passing 0.5 or -0.5 here. Returns the list of curvature values if attribute is None, otherwise None.

Given a list of points and a desired corner radius, returns a list containing proposed corner radii for each of the points such that it is ensured that the corner radius at a point is never larger than half of the minimum distance between the point and its neighbors.

def euclidean_distance(x1, y1, x2, y2):

Computes the Euclidean distance between points (x1,y1) and (x2,y2).

def evaluate_cubic_bezier(x0, y0, x1, y1, x2, y2, x3, y3, t):

Evaluates the Bezier curve from point (x0,y0) to (x3,y3) via control points (x1,y1) and (x2,y2) at t. t is typically in the range [0; 1] such that 0 returns (x0, y0) and 1 returns (x3, y3).

def get_bezier_control_points_for_curved_edge(x1, y1, x2, y2, curvature):

Helper function that calculates the Bezier control points for a curved edge that goes from (x1, y1) to (x2, y2).

def intersect_bezier_curve_and_circle(x0, y0, x1, y1, x2, y2, x3, y3, radius, max_iter=10):

Binary search solver for finding the intersection of a Bezier curve and a circle centered at the curve's end point.

Returns the x, y coordinates of the intersection point.

def str_to_orientation(value, reversed_horizontal=False, reversed_vertical=False):

Tries to interpret a string as an orientation value.

The following basic values are understood: ``left-right``, ``bottom-top``, ``right-left``, ``top-bottom``. Possible aliases are:

• ``horizontal``, ``horiz``, ``h`` and ``lr`` for ``left-right``
• ``vertical``, ``vert``, ``v`` and ``tb`` for top-bottom.
• ``lr`` for ``left-right``.
• ``rl`` for ``right-left``.

``reversed_horizontal`` reverses the meaning of ``horizontal``, ``horiz`` and ``h`` to ``rl`` (instead of ``lr``); similarly, ``reversed_vertical`` reverses the meaning of ``vertical``, ``vert`` and ``v`` to ``bt`` (instead of ``tb``).

Returns one of ``lr``, ``rl``, ``tb`` or ``bt``, or throws ``ValueError`` if the string cannot be interpreted as an orientation.