Find the length of the shortest path to any cell of a particular type

shortest_path_to_cell_type(cells, path.matrix, cell.type.value)

Arguments

cells

sf object.

path.matrix

Matrix with path lengths between each pair of cells. Recommended to use output from cell_graph_shortest_paths().

cell.type.value

Numeric. The value of stomata.

Value

A numeric vector with the distance (in cells) to the nearest cell with value cell.type.value.

Details

For cells with the same value as cell.type.value, this algorithm finds the path length to the nearest other cell of that type.