コード例 #1
0
        public void TestLiveEdgeDynamicGraphVertex()
        {
            using (var graph = new MemoryMappedFileDynamicGraph <LiveEdge>(1000, 1024))
            {
                var vertex = graph.AddVertex(51, 4);

                float latitude, longitude;
                graph.GetVertex(vertex, out latitude, out longitude);
                Assert.AreEqual(51, latitude);
                Assert.AreEqual(4, longitude);
                graph.SetVertex(vertex, 52, 5);
                graph.GetVertex(vertex, out latitude, out longitude);
                Assert.AreEqual(52, latitude);
                Assert.AreEqual(5, longitude);

                var arcs = graph.GetEdges(vertex);
                Assert.AreEqual(0, arcs.Length);

                Assert.IsFalse(graph.GetVertex(100, out latitude, out longitude));
            }
        }
コード例 #2
0
        public void TestLiveEdgeDynamicGraphVertex10000()
        {
            using (var graph = new MemoryMappedFileDynamicGraph <LiveEdge>(1000, 1024))
            {
                int count = 10000;
                while (count > 0)
                {
                    var vertex = graph.AddVertex(51, 4);

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

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

                    var arcs = graph.GetEdges(vertex);
                    Assert.AreEqual(0, arcs.Length);

                    count--;
                }

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