예제 #1
0
        /// <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));
        }
예제 #2
0
 /// <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);
 }
예제 #3
0
 /// <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));
 }
예제 #4
0
 /// <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));
 }
예제 #5
0
 /// <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));
 }