Exemple #1
0
            VfGraph SetupGraph()
            {
                Graph graph = new Graph();

                Assert.AreEqual(0, graph.InsertNode());
                Assert.AreEqual(1, graph.InsertNode());
                Assert.AreEqual(2, graph.InsertNode());
                Assert.AreEqual(3, graph.InsertNode());
                Assert.AreEqual(4, graph.InsertNode());
                Assert.AreEqual(5, graph.InsertNode());
                graph.InsertEdge(0, 1);
                graph.InsertEdge(1, 2);
                graph.InsertEdge(2, 3);
                graph.InsertEdge(3, 4);
                graph.InsertEdge(4, 5);
                graph.InsertEdge(5, 0);
                graph.DeleteNode(0);
                graph.DeleteNode(1);
                graph.InsertEdge(5, 2);
                graph.InsertEdge(2, 4);

                return(new VfGraph(graph, (new CmpNodeDegrees(graph)).Permutation));
            }
Exemple #2
0
            public void TestDeleteNode()
            {
                Graph gr = new Graph();

                Assert.AreEqual(0, gr.InsertNode());
                Assert.AreEqual(1, gr.InsertNode());
                Assert.AreEqual(2, gr.InsertNode());
                gr.InsertEdge(0, 1);
                gr.InsertEdge(1, 2);
                gr.InsertEdge(2, 0);
                gr.DeleteNode(0);

                Assert.AreEqual(1, gr.OutEdgeCount(1));
                Assert.AreEqual(0, gr.OutEdgeCount(2));

                // Trigger the exception - shouldn't be a zero node any more...
                gr.FindNode(0);
            }