コード例 #1
0
        public void TestingGraphAddEdgesSimpler()
        {
            var graph = new GraphExercise();

            graph.AddVertex(new GraphNode(0));
            graph.AddVertex(new GraphNode(1));
            graph.AddVertex(new GraphNode(2));

            graph.AddEdge(new GraphNode(0), new GraphNode(1));
            graph.AddEdge(new GraphNode(1), new GraphNode(2));
            graph.AddEdge(new GraphNode(2), new GraphNode(0));

            graph.ShowConnections();
        }
コード例 #2
0
        public void TestingGraphAddVertex()
        {
            var graph = new GraphExercise();

            graph.AddVertex(new GraphNode(0));
            graph.AddVertex(new GraphNode(1));
            graph.AddVertex(new GraphNode(2));
            graph.AddVertex(new GraphNode(3));
            graph.AddVertex(new GraphNode(4));
            graph.AddVertex(new GraphNode(5));
            graph.AddVertex(new GraphNode(6));

            graph.ShowConnections();

            var result = graph.GetNumberOfNodes();

            Assert.AreEqual(7, result);
        }