Exemplo n.º 1
0
        public void TestSimpleWeighedDynamicGraphEdge10000()
        {
            int count = 10000;
            PreProcessedDynamicGraph graph = new PreProcessedDynamicGraph();
            uint vertex1 = graph.AddVertex(51, 1);
            while (count > 0)
            {
                uint vertex2 = graph.AddVertex(51, 1);

                graph.AddArc(vertex1, vertex2, new PreProcessedEdge(
                    100, true, true, 0), null);

                KeyValuePair<uint, PreProcessedEdge>[] arcs = graph.GetArcs(vertex1);
                Assert.AreEqual(10000 - count + 1, arcs.Length);

                graph.AddArc(vertex2, vertex1, new PreProcessedEdge(
                    200, true, true, 0), null);

                arcs = graph.GetArcs(vertex2);
                Assert.AreEqual(1, arcs.Length);
                Assert.AreEqual(200, arcs[0].Value.Weight);
                Assert.AreEqual(vertex1, arcs[0].Key);

                count--;
            }
        }
Exemplo n.º 2
0
        public void TestSimpleWeighedDynamicGraphVertex()
        {
            PreProcessedDynamicGraph graph = new PreProcessedDynamicGraph();
            uint vertex = graph.AddVertex(51, 4);

            float latitude, longitude;
            graph.GetVertex(vertex, out latitude, out longitude);

            Assert.AreEqual(51, latitude);
            Assert.AreEqual(4, longitude);

            KeyValuePair<uint, PreProcessedEdge>[] arcs = graph.GetArcs(vertex);
            Assert.AreEqual(0, arcs.Length);
        }
Exemplo n.º 3
0
        public void TestSimpleWeighedDynamicGraphVertex10000()
        {
            PreProcessedDynamicGraph graph = new PreProcessedDynamicGraph();
            int count = 10000;
            while (count > 0)
            {
                uint vertex = graph.AddVertex(51, 4);

                float latitude, longitude;
                graph.GetVertex(vertex, out latitude, out longitude);

                Assert.AreEqual(51, latitude);
                Assert.AreEqual(4, longitude);

                KeyValuePair<uint, PreProcessedEdge>[] arcs = graph.GetArcs(vertex);
                Assert.AreEqual(0, arcs.Length);

                count--;
            }

            Assert.AreEqual((uint)10000, graph.VertexCount);
        }