tom | e348941 | 2014-08-29 02:30:38 -0700 | [diff] [blame] | 1 | package org.onlab.graph; |
| 2 | |
| 3 | |
| 4 | import java.util.Set; |
| 5 | |
| 6 | /** |
| 7 | * Abstraction of a directed graph structure. |
| 8 | * |
| 9 | * @param <V> vertex type |
| 10 | * @param <E> edge type |
| 11 | */ |
| 12 | public interface Graph<V extends Vertex, E extends Edge> { |
| 13 | |
| 14 | /** |
| 15 | * Returns the set of vertexes comprising the graph. |
| 16 | * |
| 17 | * @return set of vertexes |
| 18 | */ |
| 19 | Set<V> getVertexes(); |
| 20 | |
| 21 | /** |
| 22 | * Returns the set of edges comprising the graph. |
| 23 | * |
| 24 | * @return set of edges |
| 25 | */ |
| 26 | Set<E> getEdges(); |
| 27 | |
| 28 | /** |
| 29 | * Returns all edges leading out from the specified source vertex. |
| 30 | * |
| 31 | * @param src source vertex |
| 32 | * @return set of egress edges; empty if no such edges |
| 33 | */ |
| 34 | Set<E> getEdgesFrom(V src); |
| 35 | |
| 36 | /** |
| 37 | * Returns all edges leading towards the specified destination vertex. |
| 38 | * |
| 39 | * @param dst destination vertex |
| 40 | * @return set of ingress vertexes; empty if no such edges |
| 41 | */ |
| 42 | Set<E> getEdgesTo(V dst); |
| 43 | |
| 44 | } |