Class DirectedGraph<T extends ExplicitVertexID>


  • public class DirectedGraph<T extends ExplicitVertexID>
    extends java.lang.Object
    • Field Detail

      • INITIAL_SIZE

        private static int INITIAL_SIZE
      • edgeLength

        private int edgeLength
      • inOrderVerticeData

        private java.util.ArrayList inOrderVerticeData
      • vertexIDCounter

        int vertexIDCounter
    • Constructor Detail

      • DirectedGraph

        public DirectedGraph()
    • Method Detail

      • growEdges

        protected Edge<T>[] growEdges​(Edge<T>[] array,
                                      int realLength)
      • getEdges

        protected Edge<T>[] getEdges()
      • addEdge

        protected Edge<T> addEdge​(Edge<T> newEdge)
      • removeEdge

        public void removeEdge​(Edge<T> edge)
      • vertices

        public java.util.Collection<Vertex<T>> vertices()
      • edges

        public java.util.Collection<Edge<T>> edges()
      • edgesOfType

        public java.lang.Iterable<Edge<T>> edgesOfType​(java.lang.Object type)
      • allData

        public java.util.Collection<T> allData()
      • getInorderData

        public java.util.Collection<T> getInorderData()
        Returns:
        data in the order it was added to this graph.
      • addEdge

        public void addEdge​(T source,
                            T destination,
                            java.lang.Object type)
      • removeEdge

        public void removeEdge​(T source,
                               T destination)
      • findVertexFor

        public Vertex<T> findVertexFor​(T data)
      • findOrCreateVertexFor

        public Vertex<T> findOrCreateVertexFor​(T data)
        Find existing vertex and if it is not present create it.
        Parameters:
        data - to find a vertex for
        Returns:
        vertex for given data. If vertex is not present it creates vertex and returns it.
      • removeVertexFor

        public void removeVertexFor​(T data)
      • size

        public int size()
        Returns:
        the number of vertices in the graph.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object