예제 #1
0
        static void add_S(Vertice u, SortedDictionary <string, Vertice> S)
        {
            Vertice vertice;

            if (S.TryGetValue(u.get_id(), out vertice))
            {
                vertice = u;
            }
            else
            {
                S.Add(u.get_id(), u);
            }
        }
예제 #2
0
        static Vertice extract_min(SortedDictionary <string, Vertice> Q)
        {
            var     key = Q.Keys.ToList()[0];
            Vertice min = Q[key];

            foreach (KeyValuePair <string, Vertice> v in Q)
            {
                if (v.Value.get_distancia() < min.get_distancia())
                {
                    min = v.Value;
                }
            }
            Q.Remove(min.get_id());
            return(min);
        }