Class AbstractPathElement<V,​E>

  • Direct Known Subclasses:
    BellmanFordPathElement, RankingPathElement

    abstract class AbstractPathElement<V,​E>
    extends java.lang.Object
    A new path is created from a path concatenated to an edge. It's like a linked list.
    The empty path is composed only of one vertex.
    In this case the path has no previous path element.
    .

    NOTE jvs 1-Jan-2008: This is an internal data structure for use in algorithms. For returning paths to callers, use the public GraphPath interface instead.

    Since:
    July 5, 2007
    • Field Detail

      • nHops

        protected int nHops
        Number of hops of the path.
      • prevEdge

        protected E prevEdge
        Edge reaching the target vertex of the path.
      • vertex

        private V vertex
        Target vertex.
    • Constructor Detail

      • AbstractPathElement

        protected AbstractPathElement​(Graph<V,​E> graph,
                                      AbstractPathElement<V,​E> pathElement,
                                      E edge)
        Creates a path element by concatenation of an edge to a path element.
        Parameters:
        pathElement -
        edge - edge reaching the end vertex of the path element created.
      • AbstractPathElement

        protected AbstractPathElement​(AbstractPathElement<V,​E> original)
        Copy constructor.
        Parameters:
        original - source to copy from
      • AbstractPathElement

        protected AbstractPathElement​(V vertex)
        Creates an empty path element.
        Parameters:
        vertex - end vertex of the path element.
    • Method Detail

      • createEdgeListPath

        public java.util.List<E> createEdgeListPath()
        Returns the path as a list of edges.
        Returns:
        list of Edge.
      • getHopCount

        public int getHopCount()
        Returns the number of hops (or number of edges) of the path.
        Returns:
        .
      • getPrevEdge

        public E getPrevEdge()
        Returns the edge reaching the target vertex of the path.
        Returns:
        null if the path is empty.
      • getPrevPathElement

        public AbstractPathElement<V,​E> getPrevPathElement()
        Returns the previous path element.
        Returns:
        null is the path is empty.
      • getVertex

        public V getVertex()
        Returns the target vertex of the path.
        Returns:
        .