Ejemplo n.º 1
0
        public (IList <Vertex> Path, TWeight Cost) ShortestPath(Vertex start, Vertex end)
        {
            var untraveled = new HashSet <Vertex>();
            var distances  = new Dictionary <Vertex, WeightWrapper>();
            var previous   = new Dictionary <Vertex, Vertex>();

            foreach (var v in Vertices.Cast <Vertex>())
            {
                distances[v] = WeightWrapper.Infinite;
                previous[v]  = null;
                untraveled.Add(v);
            }
            distances[start] = WeightWrapper.For(default);