コード例 #1
0
        public void TestPriorityCalculation1NoWitnesses()
        {
            var graph = new DirectedGraph<CHEdgeData>();
            var vertex1 = graph.AddVertex(1, 0);
            var vertex2 = graph.AddVertex(2, 0);
            var vertex3 = graph.AddVertex(3, 0);

            graph.AddEdge(vertex1, vertex3, new CHEdgeData(1, true, true, true, 10));
            graph.AddEdge(vertex3, vertex1, new CHEdgeData(1, false, true, true, 10));
            graph.AddEdge(vertex2, vertex3, new CHEdgeData(1, true, true, true, 10));
            graph.AddEdge(vertex3, vertex2, new CHEdgeData(1, false, true, true, 10));

            var witnessCalculator = new DykstraWitnessCalculator(int.MaxValue);
            var priorityCalculator = new EdgeDifferenceContractedSearchSpace(graph, witnessCalculator);

            int newEdges, removedEdges, contracted, depth;
            priorityCalculator.Calculate(vertex1, out newEdges, out removedEdges, out depth, out contracted);
            Assert.AreEqual(0, newEdges);
            Assert.AreEqual(1, removedEdges);
            Assert.AreEqual(0, depth);
            Assert.AreEqual(0, contracted);
            priorityCalculator.Calculate(vertex2, out newEdges, out removedEdges, out depth, out contracted);
            Assert.AreEqual(0, newEdges);
            Assert.AreEqual(1, removedEdges);
            Assert.AreEqual(0, depth);
            Assert.AreEqual(0, contracted);
            priorityCalculator.Calculate(vertex3, out newEdges, out removedEdges, out depth, out contracted);
            Assert.AreEqual(2, newEdges);
            Assert.AreEqual(2, removedEdges);
            Assert.AreEqual(0, depth);
            Assert.AreEqual(0, contracted);
        }