org.jgrapht.graph

## Class SimpleGraphPath<V,E>

- java.lang.Object
- - org.jgrapht.graph.SimpleGraphPath<V,E>

- All Implemented Interfaces:
    GraphPath<V,E>

      public class SimpleGraphPath<V,E>
      extends Object
      implements GraphPath<V,E>

  A vertex-based representation of a simple path. The graph must be simple for the vertices to uniquely determine a path. See `SimpleGraph`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleGraphPath(SimpleGraph<V,E> simpleGraph, List<V> vertices, double weight)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<E>` | `getEdgeList()` Returns the edges making up the path.
    `V` | `getEndVertex()` Returns the end vertex in the path.
    `SimpleGraph<V,E>` | `getGraph()` Returns the graph over which this path is defined.
    `V` | `getStartVertex()` Returns the start vertex in the path.
    `List<V>` | `getVertexList()`
    `double` | `getWeight()` Returns the weight assigned to the path.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleGraphPath

          public SimpleGraphPath(SimpleGraph<V,E> simpleGraph,
                         List<V> vertices,
                         double weight)

      Parameters:
        `simpleGraph` - The simple graph where the path is.
        `vertices` - A list of vertices that make up the path.
      Throws:
        `IllegalArgumentException` - if the vertices are not in the path or if they do not define a path in the graph.

  - ### Method Detail

    - #### getGraph

          public SimpleGraph<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 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

    - #### getVertexList

          public List<V> getVertexList()

      Returns:
        A list of the vertices that define 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

Copyright © 2016. All rights reserved.