static void add_S(Vertice u, SortedDictionary <int, 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 <int, Vertice> Q) { var key = Q.Keys.ToList()[0]; Vertice min = Q[key]; foreach (KeyValuePair <int, Vertice> v in Q) { if (v.Value.get_distancia() < min.get_distancia()) { min = v.Value; } } Q.Remove(min.get_id()); return(min); }