MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / FindSmallestEdge

Method FindSmallestEdge

include/util/static_graph.hpp:200–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198 */
199 template <typename FilterFunction>
200 EdgeIterator
201 FindSmallestEdge(const NodeIterator from, const NodeIterator to, FilterFunction &&filter) const
202 {
203 static_assert(traits::HasDataMember<EdgeArrayEntry>,
204 "Filtering on .data not possible without .data member attribute");
205
206 EdgeIterator smallest_edge = SPECIAL_EDGEID;
207 EdgeWeight smallest_weight = INVALID_EDGE_WEIGHT;
208 for (auto edge : GetAdjacentEdgeRange(from))
209 {
210 const NodeID target = GetTarget(edge);
211 const auto &data = GetEdgeData(edge);
212 if (target == to && data.weight < smallest_weight &&
213 std::forward<FilterFunction>(filter)(data))
214 {
215 smallest_edge = edge;
216 smallest_weight = data.weight;
217 }
218 }
219 return smallest_edge;
220 }
221
222 EdgeIterator FindEdgeInEitherDirection(const NodeIterator from, const NodeIterator to) const
223 {

Callers 1

operator()Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected