Beispiel #1
0
        public void Setup()
        {
            var bidirectionalEdgeCosts = new Dictionary <E, double>();

            // Create dict of forward and backward edges
            foreach (var edgePair in edgesCosts)
            {
                var edge     = edgePair.Key;
                var reversed = edge.Reversed();
                bidirectionalEdgeCosts.Add(edge, edgePair.Value);
                bidirectionalEdgeCosts.Add(reversed, edgePair.Value);
            }

            testGraph = new AdjacencyListGraph <string, Edge <string> >();
            foreach (string vertex in vertices)
            {
                testGraph.AddVertex(vertex);
            }

            foreach (E edge in edgesCosts.Keys)
            {
                testGraph.AddBidirectionalEdge(edge);
            }

            shortestPath = new Algorithms.DijkstraShortestPath <string, E>(testGraph, bidirectionalEdgeCosts);

            shortestPath.ComputeAllFromVertex("a");
        }
Beispiel #2
0
        public void Setup()
        {
            testGraph = new AdjacencyListGraph <string, Edge <string> >();

            foreach (var vertex in vertices)
            {
                testGraph.AddVertex(vertex);
            }

            foreach (var edge in edges)
            {
                testGraph.AddDirectedEdge(edge);
            }
        }
Beispiel #3
0
        public void Setup()
        {
            testGraph = new AdjacencyListGraph <string, E>();
            foreach (string vertex in vertices)
            {
                testGraph.AddVertex(vertex);
            }

            foreach (E edge in edgesCosts.Keys)
            {
                testGraph.AddDirectedEdge(edge);
            }

            shortestPath = new Algorithms.DijkstraShortestPath <string, E>(testGraph, edgesCosts);

            shortestPath.ComputeAllFromVertex("a");
        }
Beispiel #4
0
 public void Setup()
 {
     testGraph = new AdjacencyListGraph <string, Edge <string> >();
 }