01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2002, Refractions Reserach Inc.
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.graph.structure;
18:
19: import java.util.List;
20:
21: /**
22: * Represents a node in a graph. A node is a point in a graph which is
23: * iadjacent to 0 or more edges. The collection of
24: * edges that are incident/ adjacent to the node, is referred to as the
25: * "adjacency list" of the node.
26: *
27: * @see Graph
28: * @see Edge
29: *
30: * @author Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
31: *
32: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/graph/src/main/java/org/geotools/graph/structure/Node.java $
33: */
34: public interface Node extends Graphable {
35:
36: /**
37: * Adds an edge to the adjacency list of the node.
38: *
39: * @param e Adjacent edge to add.
40: */
41: public void add(Edge e);
42:
43: /**
44: * Removes an edge from the adjacency list of the node.
45: *
46: * @param e Adjacent edge to remove.
47: */
48: public void remove(Edge e);
49:
50: /**
51: * Returns an edge in the adjacency list of the node that is adjacent to
52: * another specified node. <BR>
53: * <BR>
54: * Note: It is possible for two nodes to share multiple edges between them. In
55: * this case, getEdges(Node other) can be used to obtain a complete list.
56: *
57: * @param other The other node that the desired edge to return is adjacent to.
58: *
59: * @return The first edge that is found to be adjacent to the
60: * specified node.
61: */
62: public Edge getEdge(Node other);
63:
64: /**
65: * Returns a collection of edges in the adjacency list of the node that are
66: * adjacent to another specified node.
67: *
68: * @param other The other node that the desired edges to return are
69: * adjacent to.
70: *
71: * @return List of all edges that are found to be adjacent to the specified
72: * node.
73: */
74: public List getEdges(Node other);
75:
76: /**
77: * Returns the edge adjacency list of the node.
78: *
79: * @return A list containing all edges that are adjacent to the node.
80: */
81: public List getEdges();
82:
83: /**
84: * Returns the degree of the node. The degree of a node is defined as the
85: * number of edges that are adjacent to the node.
86: *
87: * @return int Degree of node.
88: */
89: public int getDegree();
90:
91: }
|