public void TestLiveEdgeDynamicGraphRemoveAllOneVertex()
        {
            using (var graph = new MemoryMappedGraph<LiveEdge>(1000, 1024))
            {
                var vertex1 = graph.AddVertex(51, 1);
                var vertex2 = graph.AddVertex(51, 2);
                var vertex3 = graph.AddVertex(51, 3);
                var vertex4 = graph.AddVertex(51, 3);

                graph.AddEdge(vertex1, vertex2, new LiveEdge()
                {
                    Forward = true,
                    Tags = 1
                });
                graph.AddEdge(vertex2, vertex3, new LiveEdge()
                {
                    Forward = true,
                    Tags = 2
                });
                graph.AddEdge(vertex3, vertex4, new LiveEdge()
                {
                    Forward = true,
                    Tags = 3
                });

                graph.AddEdge(vertex4, vertex2, new LiveEdge()
                {
                    Forward = true,
                    Tags = 4
                });

                graph.RemoveEdges(vertex2);
                Assert.IsFalse(graph.ContainsEdge(vertex2, vertex1));
                Assert.IsFalse(graph.ContainsEdge(vertex2, vertex3));
                Assert.IsFalse(graph.ContainsEdge(vertex4, vertex2));
                Assert.IsTrue(graph.ContainsEdge(vertex3, vertex4));
            }
        }
        public void TestLiveEdgeDynamicGraphRemoveMiddle()
        {
            using (var graph = new MemoryMappedGraph<LiveEdge>(1000, 1024))
            {
                var vertex1 = graph.AddVertex(51, 1);
                var vertex2 = graph.AddVertex(51, 2);
                var vertex3 = graph.AddVertex(51, 3);
                var vertex4 = graph.AddVertex(51, 3);

                graph.AddEdge(vertex1, vertex2, new LiveEdge()
                {
                    Forward = true,
                    Tags = 1
                }, null);
                graph.AddEdge(vertex2, vertex3, new LiveEdge()
                {
                    Forward = true,
                    Tags = 2
                }, null);
                graph.AddEdge(vertex3, vertex4, new LiveEdge()
                {
                    Forward = true,
                    Tags = 3
                }, null);

                graph.AddEdge(vertex4, vertex2, new LiveEdge()
                {
                    Forward = true,
                    Tags = 4
                }, null);

                graph.RemoveEdge(vertex2, vertex3);
                Assert.IsFalse(graph.ContainsEdge(vertex2, vertex3));
                Assert.IsFalse(graph.ContainsEdge(vertex3, vertex2));

                Assert.AreEqual(graph.GetEdges(vertex1).ToKeyValuePairs().Length, 1);
                Assert.AreEqual(graph.GetEdges(vertex2).ToKeyValuePairs().Length, 2);
                Assert.AreEqual(graph.GetEdges(vertex3).ToKeyValuePairs().Length, 1);
                Assert.AreEqual(graph.GetEdges(vertex4).ToKeyValuePairs().Length, 2);
            }
        }
        public void TestLiveEdgeDynamicGraphArguments()
        {
            using (var graph = new MemoryMappedGraph<LiveEdge>(1000, 1024))
            {
                uint vertex1 = graph.AddVertex(0, 0);
                uint vertex2 = graph.AddVertex(0, 0);
                uint vertex3 = 3;

                Assert.Catch<ArgumentOutOfRangeException>(() =>
                {
                    graph.AddEdge(vertex3, vertex1, new LiveEdge(), null);
                });
                Assert.Catch<ArgumentOutOfRangeException>(() =>
                {
                    graph.AddEdge(vertex1, vertex3, new LiveEdge(), null);
                });
                Assert.Catch<ArgumentException>(() =>
                {
                    graph.AddEdge(vertex1, vertex1, new LiveEdge(), null);
                });
                Assert.Catch<ArgumentException>(() =>
                {
                    graph.AddEdge(vertex1, vertex1, new LiveEdge(), null);
                });
                Assert.Catch<ArgumentOutOfRangeException>(() =>
                {
                    graph.ContainsEdge(vertex3, vertex1);
                });
                Assert.Catch<ArgumentOutOfRangeException>(() =>
                {
                    graph.ContainsEdge(vertex1, vertex3);
                });
                LiveEdge edge;
                Assert.Catch<ArgumentOutOfRangeException>(() =>
                {
                    graph.GetEdge(vertex3, vertex1, out edge);
                });
                Assert.Catch<ArgumentOutOfRangeException>(() =>
                {
                    graph.GetEdge(vertex1, vertex3, out edge);
                });
                Assert.Catch<ArgumentOutOfRangeException>(() =>
                {
                    graph.GetEdges(vertex3);
                });
                Assert.Catch<ArgumentOutOfRangeException>(() =>
                {
                    graph.SetVertex(vertex3, 10, 10);
                });
            }
        }