construct

construct_mst(x, y[, z=None, k_neighbours=20, two_dimensions=False, scale_cut_length=0., is_tomo=False])

Constructs the minimum spanning tree (MST) of an input data set.

Parameters:
  • x (array) – Cartesian coordinates.

  • y (array) – Cartesian coordinates.

  • z (array) – Cartesian coordinates.

  • k_neighbours (int) – The number of nearest neighbours to consider when creating the k-nearest neighbour graph.

  • two_dimensions (bool) – If true assumes the data set is two dimensional.

  • scale_cut_length (float) – The minimum allowed length in the k_nearest_neighbour_graph.

  • is_tomo (bool) – Should be true if the entered x, y and z coordinates are on a unit sphere.

Returns:

Returns a tuple of the following:

  • edge_length (array) – The length of each edge in the MST.

  • edge_x, edge_y, edge_z (array) – The positional coordinates of the ends of each edge.

  • edge_index (array) – The node index of the ends of each edge.

  • num_removed_edges (int) – Number of removed edges. Only given and applicable if scale_cut_length is given.