{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / graph / _mcp / MCP / find_costs

function

skimage.graph._mcp:MCP.find_costs

Signature

def   find_costs ( self starts ends = None find_all_ends = True max_coverage = 1.0 max_cumulative_cost = <DEPRECATED> max_cost = <DEPRECATED> * max_step_cost = None )

Summary

Find the minimum-cost path from the given starting points.

Extended Summary

This method finds the minimum-cost path to the specified ending indices from any one of the specified starting indices. If no end positions are given, then the minimum-cost path to every position in the costs array will be found.

Parameters

starts : iterable

A list of n-d starting indices (where n is the dimension of the costs array). The minimum cost path to the closest/cheapest starting point will be found.

ends : iterable, optional

A list of n-d ending indices.

find_all_ends : bool, optional

If 'True' (default), the minimum-cost-path to every specified end-position will be found; otherwise the algorithm will stop when a a path is found to any end-position. (If no ends were specified, then this parameter has no effect.)

max_step_cost : float, optional

Cost limit for each step between points. Costs higher than this will form a barrier.

Returns

cumulative_costs : ndarray

Same shape as the costs array; this array records the minimum cost path from the nearest/cheapest starting index to each index considered. (If ends were specified, not all elements in the array will necessarily be considered: positions not evaluated will have a cumulative cost of inf. If find_all_ends is 'False', only one of the specified end-positions will have a finite cumulative cost.)

traceback : ndarray

Same shape as the costs array; this array contains the offset to any given index from its predecessor index. The offset indices index into the offsets attribute, which is a array of n-d offsets. In the 2-d case, if offsets[traceback[x, y]] is (-1, -1), that means that the predecessor of [x, y] in the minimum cost path to some start position is [x+1, y+1]. Note that if the offset_index is -1, then the given index was not considered.

Other Parameters

max_cost : DEPRECATED

Deprecated in favor of max_step_cost.

max_cumulative_cost : DEPRECATED

max_cumulative_cost is deprecated.

Aliases

  • skimage.graph.MCP.find_costs