DirectedGraph { public Vector<Vertex<E>> getAdjacentVertices(final Vertex<E> v) { Vector<Vertex<E>> result = new Vector<Vertex<E>>(); for (Edge<E, F> e : edges) { if (e.getPointA().equals(v)) { result.add(e.getPointB()); } } return result; } DirectedGraph(); Vector<String> listEdges(); void addVertex(Vertex<E> v); void addEdge(Vertex<E> a, Vertex<E> b); void addEdge(Vertex<E> a, Vertex<E> b, F data); void addEdge(String aLabel, String bLabel); void addEdge(String aLabel, String bLabel, F data); F getEdgeData(Vertex<E> v1, Vertex<E> v2); Vector<F> getAllEdgeData(Vertex<E> v1, Vertex<E> v2); F getEdgeData(E vData1, E vData2); Vector<F> getAllEdgeData(E vData1, E vData2); boolean isStronglyConnected(); boolean isConnected(); Vector<Vertex<E>> getAdjacentVertices(final Vertex<E> v); void removeVertex(final Vertex<E> v); Vector<Vertex<E>> topoSort(final Vertex<E> v); Vector<Vertex<E>> topoSort(final String vLabel); Vertex<E> getVertexByLabel(final String vLabel); Vertex<E> getVertexByData(final E vData); Set<Vertex<E>> sources(); Set<Vertex<E>> from(final Vertex<E> v); Set<Vertex<E>> from(E vData); Set<Vertex<E>> to(Vertex<E> v); Set<Vertex<E>> to(E vData); Set<Vertex<E>> into(Vertex<E> v); Set<Vertex<E>> into(E vData); Vector<Vertex<E>> getTopoSort(); final Set<Vertex<E>> getVertices(); final Set<Edge<E, F>> getEdges();  }
@Test public void testGetAdjacentVertices() { assertTrue(disConnect.getAdjacentVertices(a).contains(c)); assertTrue(connect.getAdjacentVertices(a).contains(c)); assertTrue(connect.getAdjacentVertices(a).contains(d)); assertTrue(connect.getAdjacentVertices(a).contains(f)); }