| org.geotools.graph.structure.Graph
All known Subclasses: org.geotools.graph.structure.basic.BasicGraph,
Graph | public interface Graph (Code) | | Represents a graph.
A graph is a collection of nodes (verticies) connected by links called
edges (arcs).
In most applications nodes of a graph represent the
objects being modelled, and the edges represent the
relationships between the objects. An example could be a polygon coverage in
which one wishes to model a boundary sharing relationship. The following is
an illustration.
In the above figure, the objects (nodes) are the polygons themselves, and the
relationship (edges) between them is boundary sharing.
However, there exists types of graphs in which the roles are reversed and the
edges are the objects, and the nodes are the relationships. An example of
such a graph is the stream network shown below.
In the above figure, the objects (edges) are the stream segments and the
relationship (nodes) between them is endpoint sharing. However, if
desirable one could model the second case similar to the first. The
resulting graph is shown below.
The Graph object is intended to serve as a container for a collection
of nodes and edges. It does dont define or manage the relationship among the
components it contains.
See Also: Node See Also: Edge author: Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net |
Field Summary | |
final public static int | FAIL_QUERY Signal to indicate that a graph component does NOT meet the requirements
of a query made against the graph. | final public static int | PASS_AND_CONTINUE Signal to indicate that a graph component meets the requirements of a
query against a graph and that the query should continue. | final public static int | PASS_AND_STOP Signal to indicate that a graph component meets the requirements of a
query against a graph and that the query should end. |
Method Summary | |
public Collection | getEdges() Returns the edges of the graph. | public Collection | getNodes() Returns the nodes of the graph. | public List | getNodesOfDegree(int n) Returns all the nodes in the graph of a specified degree. | public List | getVisitedEdges(boolean visited) Returns all the edges in the graph that have been marked as visited or
non-visited.
Parameters: visited - True if edge is visited, false if edge is unvisited. | public List | getVisitedNodes(boolean visited) Returns all the nodes in the graph that have been marked as visited or
non-visited.
Parameters: visited - True if node is visited, false if node is unvisited. | public List | queryEdges(GraphVisitor visitor) Performs a query against the edges of the graph. | public List | queryNodes(GraphVisitor visitor) Performs a query against the nodes of the graph. | public void | visitEdges(GraphVisitor visitor) Applies the visitor pattern to the edges of the graph. | public void | visitNodes(GraphVisitor visitor) Applies the visitor pattern to the nodes of the graph. |
FAIL_QUERY | final public static int FAIL_QUERY(Code) | | Signal to indicate that a graph component does NOT meet the requirements
of a query made against the graph.
|
PASS_AND_CONTINUE | final public static int PASS_AND_CONTINUE(Code) | | Signal to indicate that a graph component meets the requirements of a
query against a graph and that the query should continue.
|
PASS_AND_STOP | final public static int PASS_AND_STOP(Code) | | Signal to indicate that a graph component meets the requirements of a
query against a graph and that the query should end.
|
getEdges | public Collection getEdges()(Code) | | Returns the edges of the graph.
A collection of Edge objects. See Also: Edge |
getNodes | public Collection getNodes()(Code) | | Returns the nodes of the graph.
A collection of Node objects. See Also: Node |
getNodesOfDegree | public List getNodesOfDegree(int n)(Code) | | Returns all the nodes in the graph of a specified degree. The degree of
a node is the number of edges that are adjacent to the node.
Parameters: n - The desired degree of nodes to be returned. A collection of nodes of degree n. See Also: Node.getDegree |
getVisitedEdges | public List getVisitedEdges(boolean visited)(Code) | | Returns all the edges in the graph that have been marked as visited or
non-visited.
Parameters: visited - True if edge is visited, false if edge is unvisited. List of edges marked as visited / non-visited. See Also: Graphable.isVisited |
getVisitedNodes | public List getVisitedNodes(boolean visited)(Code) | | Returns all the nodes in the graph that have been marked as visited or
non-visited.
Parameters: visited - True if node is visited, false if node is unvisited. List of nodes marked as visited / non-visited. See Also: Graphable.isVisited |
queryEdges | public List queryEdges(GraphVisitor visitor)(Code) | | Performs a query against the edges of the graph. Each Edge object
contained in the graph is passed to a GraphVisitor to determine if it
meets the query criteria.
Parameters: visitor - Determines if the meets the query criteria. Returns MEET_AND_CONTINUE to signal that the edge meets the query criteria and the query should continue. Returns MEET_AND_STOP to signal that the edge meest the query criteria andthe query should stop. FAIL_QUERY to signal that the edge does NOT meet the query criteria. A collection of edges that meet the query criteria. See Also: Edge See Also: GraphVisitor |
queryNodes | public List queryNodes(GraphVisitor visitor)(Code) | | Performs a query against the nodes of the graph. Each Node object
contained in the graph is passed to a GraphVisitor to determine if it
meets the query criteria.
Parameters: visitor - Determines if node meets query criteria. Returns MEET_AND_CONTINUE to signal that the node meets the query criteria and the query should continue. Returns MEET_AND_STOP to signal that the node meest the query criteria andthe query should stop. FAIL_QUERY to signal that the node does NOT meet the query criteria. A collection of nodes that meet the query criteria. See Also: Node See Also: GraphVisitor |
visitEdges | public void visitEdges(GraphVisitor visitor)(Code) | | Applies the visitor pattern to the edges of the graph.
Parameters: visitor - |
visitNodes | public void visitNodes(GraphVisitor visitor)(Code) | | Applies the visitor pattern to the nodes of the graph.
Parameters: visitor - |
|
|