The skimage.graph documentation states that the goal_reached method can be overloaded to introduce additional constraints on finding the minimum cost path. I'm having some trouble implementing this but I can't find any useful examples to follow online. I'm hoping someone can provide some guidance.
I need to implement a minimum cost path through an array of costs. The added twist is that I need to ensure the path does not exceed some maximum geometric distance (represented as a total number of cells). So I need my goal_reached() method to check whether the current path has exceeded the maximum number of cells and return 1 if true (which tells MCP to stop checking neighbors).
Is there a good example implementation somewhere that I can refer to for some guidance? Here's what I have so far.
graph = MCP(costSurfaceArray,fully_connected=False)
def goal_reached(index, cumcost):
'''not sure what to do here'''
graph.goal_reached = goal_reached