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); } }
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); }