Thomas Vachuska | 24c849c | 2014-10-27 09:53:05 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 2 | * Copyright 2014 Open Networking Laboratory |
Thomas Vachuska | 24c849c | 2014-10-27 09:53:05 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Thomas Vachuska | 24c849c | 2014-10-27 09:53:05 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Thomas Vachuska | 24c849c | 2014-10-27 09:53:05 -0700 | [diff] [blame] | 15 | */ |
tom | e348941 | 2014-08-29 02:30:38 -0700 | [diff] [blame] | 16 | package org.onlab.graph; |
| 17 | |
| 18 | |
| 19 | import java.util.Set; |
| 20 | |
| 21 | /** |
| 22 | * Abstraction of a directed graph structure. |
| 23 | * |
| 24 | * @param <V> vertex type |
| 25 | * @param <E> edge type |
| 26 | */ |
| 27 | public interface Graph<V extends Vertex, E extends Edge> { |
| 28 | |
| 29 | /** |
| 30 | * Returns the set of vertexes comprising the graph. |
| 31 | * |
| 32 | * @return set of vertexes |
| 33 | */ |
| 34 | Set<V> getVertexes(); |
| 35 | |
| 36 | /** |
| 37 | * Returns the set of edges comprising the graph. |
| 38 | * |
| 39 | * @return set of edges |
| 40 | */ |
| 41 | Set<E> getEdges(); |
| 42 | |
| 43 | /** |
| 44 | * Returns all edges leading out from the specified source vertex. |
| 45 | * |
| 46 | * @param src source vertex |
| 47 | * @return set of egress edges; empty if no such edges |
| 48 | */ |
| 49 | Set<E> getEdgesFrom(V src); |
| 50 | |
| 51 | /** |
| 52 | * Returns all edges leading towards the specified destination vertex. |
| 53 | * |
| 54 | * @param dst destination vertex |
| 55 | * @return set of ingress vertexes; empty if no such edges |
| 56 | */ |
| 57 | Set<E> getEdgesTo(V dst); |
| 58 | |
| 59 | } |