/// <summary> /// Returns an edge path for the path represented by the given pointer. /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public static EdgePath <T> GetPath <T>(this WeightHandler <T> weightHandler, PathTree pathTree, uint pointer) where T : struct { uint vertex, previous; T weight; weightHandler.GetPathTree(pathTree, pointer, out vertex, out weight, out previous); if (previous == uint.MaxValue) { return(new EdgePath <T>(vertex)); } var previousPath = weightHandler.GetPath(pathTree, previous); return(new EdgePath <T>(vertex, weight, previousPath)); }
/// <summary> /// Returns true if weigh1 smaller than metric according to the weight handler. /// </summary> public static bool IsSmallerThan <T>(this WeightHandler <T> handler, T weight1, float metric) where T : struct { return(handler.GetMetric(weight1) < metric); }
/// <summary> /// Returns true if weigh1 smaller than weight2 according to the weight handler. /// </summary> public static bool IsSmallerThanOrEqual <T>(this WeightHandler <T> handler, T weight1, T weight2) where T : struct { return(handler.GetMetric(weight1) <= handler.GetMetric(weight2)); }
/// <summary> /// Returns true if weigh1 > weight2 according to the weight handler. /// </summary> public static bool IsLargerThan <T>(this WeightHandler <T> handler, T weight1, T weight2) where T : struct { return(handler.GetMetric(weight1) > handler.GetMetric(weight2)); }
/// <summary> /// Checks if the given graph can be used with the weight handler. /// </summary> public static void CheckCanUse <T>(this WeightHandler <T> weightHandler, DirectedDynamicGraph graph) where T : struct { weightHandler.CheckCanUse(new ContractedDb(graph)); }