locan.data.hulls.alpha_shape.AlphaComplex#

class locan.data.hulls.alpha_shape.AlphaComplex(points, delaunay=None)[source]#

Bases: object

Class for an alpha-independent representation of the alpha complex of the given points.

Here the alpha complex is the simplicial subcomplex of the Delaunay triangulation together with the intervals defining simplex membership for an alpha complex for a specific alpha.

Parameters:
  • points (npt.ArrayLike) – Coordinates of input points with shape (npoints, ndim).

  • delaunay (scipy.spatial.Delaunay | None) – Object with attribute simplices specifying a list of indices in the array of points that define the simplexes in the Delaunay triangulation. Also, an attribute neighbor is required that specifies indices of neighboring simplices. If None, scipy.stat.Delaunay(points) is computed.

Variables:
  • lines (list[tuple[tuple[int, ...], float, float, float]]) – 1-simplices (lines) that represent a simplicial subcomplex of the Delaunay triangulation with intervals. Array with shape (n_lines, 2).

  • triangles (list[tuple[int, float, float, float]]) – 2-simplices (triangles) that represent a simplicial subcomplex of the Delaunay triangulation with intervals. Array with shape (n_triangles, 3).

  • tetrahedrons (list[tuple]) – 3-simplices (tetrahedrons) that represent a simplicial subcomplex of the Delaunay triangulation with intervals. Array with shape (n_tetrahedrons, 4).

  • dimension (int) – Spatial dimension of the hull.

  • delaunay_triangulation (scipy.spatial.Delaunay) – Object with attribute simplices specifying a list of indices in the array of points that define the simplexes in the Delaunay triangulation. Also, an attribute neighbor is required that specifies indices of neighboring simplices.

Methods

__init__(points[, delaunay])

alpha_shape(alpha)

Return the unique alpha shape for alpha.

alphas()

Return alpha values at which the corresponding alpha shape changes.

get_alpha_complex_lines(alpha[, type])

Simplicial subcomplex (lines) of the Delaunay triangulation for the specific alpha complex for the given alpha.

get_alpha_complex_triangles(alpha[, type])

Simplicial subcomplex (triangles) of the Delaunay triangulation for the specific alpha complex for the given alpha.

graph_from_lines(alpha[, type])

Return networkx Graph object with nodes and edges from selected lines.

graph_from_triangles(alpha[, type])

Return networkx Graph object with nodes and edges from selected triangles.

optimal_alpha()

Find the minimum alpha value for which all points belong to the alpha shape, in other words, no edges of the Delaunay triangulation are exterior.

alpha_shape(alpha)[source]#

Return the unique alpha shape for alpha.

Parameters:

alpha (float) – Alpha parameter specifying a unique alpha complex.

Return type:

AlphaShape

alphas()[source]#

Return alpha values at which the corresponding alpha shape changes.

Return type:

npt.NDArray[np.float64]

get_alpha_complex_lines(alpha, type='all')[source]#

Simplicial subcomplex (lines) of the Delaunay triangulation for the specific alpha complex for the given alpha.

Parameters:
  • alpha (float) – Alpha parameter specifying a unique alpha complex.

  • type (Literal['all', 'regular', 'singular', 'interior', 'exterior']) – Type of alpha complex edges to be included in the graph. One of ‘all’, ‘regular’, ‘singular’, ‘interior’, ‘exterior’.

Returns:

The indices to specific points in self.points.

Return type:

list[list[int]]

get_alpha_complex_triangles(alpha, type='all')[source]#

Simplicial subcomplex (triangles) of the Delaunay triangulation for the specific alpha complex for the given alpha.

Parameters:
  • alpha (float) – Alpha parameter specifying a unique alpha complex.

  • type (Literal['all', 'regular', 'singular', 'interior', 'exterior']) – Type of alpha complex edges to be included in the graph. One of ‘all’, ‘regular’, ‘singular’, ‘interior’, ‘exterior’.

Returns:

The indices to specific d-simplices in self.delaunay_triangulation.simplices.

Return type:

list[int]

graph_from_lines(alpha, type='all')[source]#

Return networkx Graph object with nodes and edges from selected lines.

Parameters:
  • alpha (float) – Alpha parameter specifying a unique alpha complex.

  • type (Literal['all', 'regular', 'singular', 'interior', 'exterior']) – Type of alpha complex edges to be included in the graph. One of ‘all’, ‘regular’, ‘singular’, ‘interior’, ‘exterior’.

Return type:

networkx.Graph

graph_from_triangles(alpha, type='all')[source]#

Return networkx Graph object with nodes and edges from selected triangles.

Parameters:
  • alpha (float) – Alpha parameter specifying a unique alpha complex.

  • type (Literal['all', 'regular', 'singular', 'interior', 'exterior']) – Type of alpha complex edges to be included in the graph. One of ‘all’, ‘regular’, ‘singular’, ‘interior’, ‘exterior’.

Return type:

networkx.Graph

optimal_alpha()[source]#

Find the minimum alpha value for which all points belong to the alpha shape, in other words, no edges of the Delaunay triangulation are exterior.

Return type:

float | None