Class GraphPathImpl<V,​E>

  • All Implemented Interfaces:
    GraphPath<V,​E>

    public class GraphPathImpl<V,​E>
    extends java.lang.Object
    implements GraphPath<V,​E>
    GraphPathImpl is a default implementation of GraphPath.
    Version:
    $Id: GraphPathImpl.java 689 2009-07-04 06:40:29Z perfecthash $
    Author:
    John Sichi
    • Constructor Summary

      Constructors 
      Constructor Description
      GraphPathImpl​(Graph<V,​E> graph, V startVertex, V endVertex, java.util.List<E> edgeList, double weight)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<E> getEdgeList()
      Returns the edges making up the path.
      V getEndVertex()
      Returns the end vertex in the path.
      Graph<V,​E> getGraph()
      Returns the graph over which this path is defined.
      V getStartVertex()
      Returns the start vertex in the path.
      double getWeight()
      Returns the weight assigned to the path.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GraphPathImpl

        public GraphPathImpl​(Graph<V,​E> graph,
                             V startVertex,
                             V endVertex,
                             java.util.List<E> edgeList,
                             double weight)
    • Method Detail

      • getGraph

        public Graph<V,​E> getGraph()
        Description copied from interface: GraphPath
        Returns the graph over which this path is defined. The path may also be valid with respect to other graphs.
        Specified by:
        getGraph in interface GraphPath<V,​E>
        Returns:
        the containing graph
      • getStartVertex

        public V getStartVertex()
        Description copied from interface: GraphPath
        Returns the start vertex in the path.
        Specified by:
        getStartVertex in interface GraphPath<V,​E>
        Returns:
        the start vertex
      • getEndVertex

        public V getEndVertex()
        Description copied from interface: GraphPath
        Returns the end vertex in the path.
        Specified by:
        getEndVertex in interface GraphPath<V,​E>
        Returns:
        the end vertex
      • getEdgeList

        public java.util.List<E> getEdgeList()
        Description copied from interface: GraphPath
        Returns the edges making up the path. The first edge in this path is incident to the start vertex. The last edge is incident to the end vertex. The vertices along the path can be obtained by traversing from the start vertex, finding its opposite across the first edge, and then doing the same successively across subsequent edges; Graphs.getPathVertexList(org.jgrapht.GraphPath<V, E>) provides a convenience method for this.

        Whether or not the returned edge list is modifiable depends on the path implementation.

        Specified by:
        getEdgeList in interface GraphPath<V,​E>
        Returns:
        list of edges traversed by the path
      • getWeight

        public double getWeight()
        Description copied from interface: GraphPath
        Returns the weight assigned to the path. Typically, this will be the sum of the weights of the edge list entries (as defined by the containing graph), but some path implementations may use other definitions.
        Specified by:
        getWeight in interface GraphPath<V,​E>
        Returns:
        the weight of the path
      • toString

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