Class DirectedGraph<T extends ExplicitVertexID, U>

java.lang.Object
org.jruby.dirgra.DirectedGraph<T,U>

public class DirectedGraph<T extends ExplicitVertexID, U> extends Object
  • Constructor Details

    • DirectedGraph

      public DirectedGraph()
  • Method Details

    • growEdges

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

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

      protected Edge<T,U> addEdge(Edge<T,U> newEdge)
    • removeEdge

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

      public Collection<Vertex<T,U>> vertices()
    • edges

      public Collection<Edge<T,U>> edges()
    • edgesOfType

      public Iterable<Edge<T,U>> edgesOfType(U type)
    • allData

      public Collection<T> allData()
    • getInorderData

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

      public void addEdge(T source, T destination, U type)
    • removeEdge

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

      public Vertex<T,U> findVertexFor(T data)
    • findOrCreateVertexFor

      public Vertex<T,U> 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 String toString()
      Overrides:
      toString in class Object