View Javadoc

1   package org.apache.commons.graph;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.List;
23  
24  /**
25   * A {@code Path} in a {@link Graph} is a sequence of {@link Vertex} such that from each of its vertices there is an
26   * {@link Edge} to the next {@link Vertex} in the sequence.
27   *
28   * @param <V> the Graph vertices type
29   * @param <E> the Graph edges type
30   */
31  public interface Path<V extends Vertex, E extends Edge<V>>
32  {
33  
34      /**
35       * Returns the source of the path.
36       */
37      V getSource();
38  
39      /**
40       * Returns the target of the path.
41       */
42      V getTarget();
43  
44      /**
45       * getVertices() - This returns a list of Vertices, in order as they go from
46       * Start to End. This includes the Start and End vertex, and will have one
47       * more entry than the Edges list.
48       */
49      List<V> getVertices();
50  
51      /**
52       * getEdges() - This returns a list of Edges which comprise the path. It
53       * will have one less than the list of Vertices.
54       */
55      List<E> getEdges();
56  
57      /**
58       * size() - This returns the size of the path in terms of number of
59       * verticies it visits.
60       */
61      int size();
62  
63  }