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);
        }
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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());
        }
Esempio n. 6
0
        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());
        }
Esempio n. 7
0
        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");
        }