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.Set;
23
24 /**
25 * A Graph data structure consists of a finite (and possibly mutable) set of ordered pairs,
26 * called {@link Edge}s or arcs, of certain entities called {@link Vertex} or node.
27 * As in mathematics, an {@link Edge} {@code (x,y)} is said to point or go from {@code x} to {@code y}.
28 *
29 * @param <V> the Graph vertices type
30 * @param <E> the Graph edges type
31 */
32 public interface Graph<V extends Vertex, E extends Edge<V>>
33 {
34
35 /**
36 * Returns the total set of Vertices in the graph.
37 *
38 * @return the total set of Vertices in the graph.
39 */
40 Set<V> getVertices();
41
42 /**
43 * Returns the total set of Edges in the graph.
44 *
45 * @return the total set of Edges in the graph.
46 */
47 Set<E> getEdges();
48
49 /**
50 * Returns all edges which touch this vertex, where the input vertex is in the edge head.
51 *
52 * @return all edges which touch this vertex, where the input vertex is in the edge head.
53 */
54 Set<E> getEdges( V v );
55
56 /**
57 * Return the set of {@link Vertex} on the input {@link Edge} (2 for normal edges, > 2 for HyperEdges)
58 *
59 * @return the set of {@link Vertex} on this Edge.
60 */
61 Set<V> getVertices( E e );
62
63 }