scale_cut

graph_scale_cut(graph, scale_cut_length, num_nodes)

Will remove all edges in the graph below the scale_cut_length.

Parameters
  • graph (csr_matrix) – A sparse matrix of the edges in a graph and corresponding node indexes.

  • scale_cut_length (float) – A minimum length scale.

  • num_nodes (int) – Number of nodes.

Returns

Returns a tuple of the following:

  • graph_cut (csr_matrix) – The original graph with distances below the scale_cut_length removed.

  • index1, index2 (array) – The node indexes of each end of the edges in the graph.

  • num_removed_edges (int) – Number of removed edges.

k_nearest_neighbour_scale_cut(x, y, scale_cut_length, k_neighbours[, z=None])

Iteratively removes edges below the scale_cut_length of a k_nearest_neighbour graph.

Parameters
  • x (array) – Cartesian coordinates.

  • y (array) – Cartesian coordinates.

  • z (array) – Cartesian coordinates.

  • scale_cut_length (float) – A minimum length scale.

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

Returns

Returns a tuple of the following:

  • x, y(, z) (array) – The 2D (3D) coordinates of the positions of the nodes.

  • knn (csr_matrix) – A sparse scale cut k_nearest_neighbour_graph.