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()); }
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"); }