public interface 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.
Modifier and Type  Field and Description 

static int 
FAIL_QUERY
Signal to indicate that a graph component does NOT meet the requirements of a query made
against the graph.

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.

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.

Modifier and Type  Method and Description 

Collection<Edge> 
getEdges()
Returns the edges of the graph.

Collection<Node> 
getNodes()
Returns the nodes of the graph.

List<Node> 
getNodesOfDegree(int n)
Returns all the nodes in the graph of a specified degree.

List<Edge> 
getVisitedEdges(boolean visited)
Returns all the edges in the graph that have been marked as visited or nonvisited.

List<Node> 
getVisitedNodes(boolean visited)
Returns all the nodes in the graph that have been marked as visited or nonvisited.

List<? extends Graphable> 
queryEdges(GraphVisitor visitor)
Performs a query against the edges of the graph.

List<Node> 
queryNodes(GraphVisitor visitor)
Performs a query against the nodes of the graph.

void 
visitEdges(GraphVisitor visitor)
Applies the visitor pattern to the edges of the graph.

void 
visitNodes(GraphVisitor visitor)
Applies the visitor pattern to the nodes of the graph.

static final int PASS_AND_CONTINUE
static final int PASS_AND_STOP
static final int FAIL_QUERY
Collection<Node> getNodes()
Node
Collection<Edge> getEdges()
Edge
List<Node> queryNodes(GraphVisitor visitor)
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.Node
,
GraphVisitor
List<? extends Graphable> queryEdges(GraphVisitor visitor)
visitor
 Determines if the meets the query criteria. Edge
,
GraphVisitor
void visitNodes(GraphVisitor visitor)
void visitEdges(GraphVisitor visitor)
List<Node> getNodesOfDegree(int n)
n
 The desired degree of nodes to be returned.Node.getDegree()
List<Node> getVisitedNodes(boolean visited)
visited
 True if node is visited, false if node is unvisited.Graphable.isVisited()
List<Edge> getVisitedEdges(boolean visited)
visited
 True if edge is visited, false if edge is unvisited.Graphable.isVisited()
Copyright © 1996–2022 Geotools. All rights reserved.