|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graph
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.
Node
,
Edge
Field Summary | |
---|---|
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. |
Method Summary | |
---|---|
java.util.Collection |
getEdges()
Returns the edges of the graph. |
java.util.Collection |
getNodes()
Returns the nodes of the graph. |
java.util.List |
getNodesOfDegree(int n)
Returns all the nodes in the graph of a specified degree. |
java.util.List |
getVisitedEdges(boolean visited)
Returns all the edges in the graph that have been marked as visited or non-visited. |
java.util.List |
getVisitedNodes(boolean visited)
Returns all the nodes in the graph that have been marked as visited or non-visited. |
java.util.List |
queryEdges(GraphVisitor visitor)
Performs a query against the edges of the graph. |
java.util.List |
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. |
Field Detail |
---|
static final int PASS_AND_CONTINUE
static final int PASS_AND_STOP
static final int FAIL_QUERY
Method Detail |
---|
java.util.Collection getNodes()
Node
java.util.Collection getEdges()
Edge
java.util.List 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
java.util.List queryEdges(GraphVisitor visitor)
visitor
- Determines if the meets the query criteria. Edge
,
GraphVisitor
void visitNodes(GraphVisitor visitor)
visitor
- void visitEdges(GraphVisitor visitor)
visitor
- java.util.List getNodesOfDegree(int n)
n
- The desired degree of nodes to be returned.
Node.getDegree()
java.util.List getVisitedNodes(boolean visited)
visited
- True if node is visited, false if node is unvisited.
Graphable.isVisited()
java.util.List getVisitedEdges(boolean visited)
visited
- True if edge is visited, false if edge is unvisited.
Graphable.isVisited()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |