Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.

search: remove weight graph.CostFunc parameter from path search functions #83

Closed
kortschak opened this issue Jun 11, 2015 · 0 comments
Closed

Comments

@kortschak
Copy link
Member

This can be done by, e.g.

type costModGraph struct {
    graph.Graph
    cost graph.CostFunc
}

func (g costModGraph) Cost(e graph.Edge) float64 {
    return g.cost(e)
}

and wrapping the graph.

This simplifies the API and the internal code and reduces the number of times we do search.PathFinder(g, nil), which seems pretty common (I see no case in our code where the cost function is provided as a graph.CostFunc rather than as intrinsic to the graph).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant