コード例 #1
0
        public void NamedUnidirectionalGraphTest()
        {
            UnidirectionalGraph graph = new UnidirectionalGraph("testUni");

            Assert.IsTrue(graph.Name == "testUni");
            GraphTestHelpers.CommonInitialize(graph);

            Assert.IsNotNull(graph.Edges);
            Assert.IsTrue(graph.Edges.Count > 0);
            Assert.IsNotNull(graph.Vertices);
            Assert.IsNotNull(graph.Vertices.Count == 6);
        }
コード例 #2
0
        public void UnidirectionalGraphTest()
        {
            UnidirectionalGraph graph = new UnidirectionalGraph();

            Assert.IsTrue(string.IsNullOrEmpty(graph.Name));
            GraphTestHelpers.CommonInitialize(graph);

            Assert.IsNotNull(graph.Edges);
            Assert.IsTrue(graph.Edges.Count > 0);
            Assert.IsNotNull(graph.Vertices);
            Assert.IsNotNull(graph.Vertices.Count == 6);
        }
コード例 #3
0
ファイル: GraphTests.cs プロジェクト: magmasystems/MagmaGraph
        public void GetVertexIndexTest()
        {
            Graph graph = new UnidirectionalGraph();

            Assert.IsTrue(graph.Directionality == Directionality.Unidirectional);

            GraphTestHelpers.CommonInitialize(graph);
            Assert.IsTrue(graph.NumVertices == 6);

            int index = graph.GetVertexIndex("b");

            Assert.IsTrue(index >= 0);
        }
コード例 #4
0
ファイル: GraphTests.cs プロジェクト: magmasystems/MagmaGraph
        public void GetVertexTest()
        {
            Graph graph = new UnidirectionalGraph();

            Assert.IsTrue(graph.Directionality == Directionality.Unidirectional);

            GraphTestHelpers.CommonInitialize(graph);
            Assert.IsTrue(graph.NumVertices == 6);

            Vertex v = graph.GetVertex("a");

            Assert.IsNotNull(v);
        }
コード例 #5
0
ファイル: GraphTests.cs プロジェクト: magmasystems/MagmaGraph
        public void GetAdjacentVerticesNoConnectionsTest()
        {
            Graph graph = new UnidirectionalGraph();

            Assert.IsTrue(graph.Directionality == Directionality.Unidirectional);

            GraphTestHelpers.CommonInitialize(graph);
            Vertex v = graph.GetVertex("z");

            Assert.IsNotNull(v);

            List <Vertex> adjacentVertices = graph.GetAdjacentVertices(v);

            Assert.IsNotNull(adjacentVertices);
            Assert.IsFalse(adjacentVertices.Any());
        }
コード例 #6
0
ファイル: GraphTests.cs プロジェクト: magmasystems/MagmaGraph
        public void GetEdgesTest()
        {
            Graph graph = new UnidirectionalGraph();

            Assert.IsTrue(graph.Directionality == Directionality.Unidirectional);

            GraphTestHelpers.CommonInitialize(graph);
            Vertex v = graph.GetVertex("a");

            Assert.IsNotNull(v);

            IEnumerable <WeightedEdge <int> > edges = graph.GetEdges(v);

            Assert.IsNotNull(edges);
            Assert.IsTrue(edges.Any());
        }
コード例 #7
0
ファイル: GraphTests.cs プロジェクト: magmasystems/MagmaGraph
        public void GetAdjacentVerticesTest()
        {
            Graph graph = new UnidirectionalGraph();

            Assert.IsTrue(graph.Directionality == Directionality.Unidirectional);

            GraphTestHelpers.CommonInitialize(graph);
            Vertex v = graph.GetVertex("a");

            Assert.IsNotNull(v);

            List <Vertex> adjacentVertices = graph.GetAdjacentVertices(v);

            Assert.IsNotNull(adjacentVertices);
            Assert.IsTrue(adjacentVertices.Any());

            // Vertex B and C should be the only vertices that are adjacent to A
            Assert.IsTrue(adjacentVertices.Count == 2);
            Assert.IsTrue(adjacentVertices[0].Name == "b");
            Assert.IsTrue(adjacentVertices[1].Name == "c");
        }