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