Package org.geotools.graph.structure.opt
Class OptNode
Object
OptGraphable
OptNode
- All Implemented Interfaces:
Serializable
,Graphable
,Node
- Direct Known Subclasses:
OptXYNode
Optimized implementation of Node. The following optimizations reduce space and improve performance.
- Edge adjacency list stored as array of predetermined size.
- Removing support for removing edges from the nodes ajdacency list.
- The related component iterator iterates over the underlying edge array of the node instread of a newly created collection.
- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
An iterator used to iterate over related nodes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an edge to the adjacency list of the node.int
Returns the degree of the node.Returns an edge in the adjacency list of the node that is adjacent to another specified node.Edge[]
Returns the edge adjacency list of the node as an array.getEdges()
Returns the edge adjacency list of the node.Returns a collection of edges in the adjacency list of the node that are adjacent to another specified node.This iterator iterates over the underlying edge array of the node.void
Not supported.void
setDegree
(int degree) Sets the degree of the node.Methods inherited from class OptGraphable
getCount, getID, getObject, isVisited, setCount, setID, setObject, setVisited
-
Constructor Details
-
OptNode
public OptNode()Constructs a new OptimizedNode. This constructor does not build the adjacency array for the node. -
OptNode
public OptNode(int degree) Constructs a new Optimized Node with a known degree.- Parameters:
degree
- The degree of the node.
-
-
Method Details
-
add
Description copied from interface:Node
Adds an edge to the adjacency list of the node. -
remove
Not supported. -
getEdge
Description copied from interface:Node
Returns an edge in the adjacency list of the node that is adjacent to another specified node.
Note: It is possible for two nodes to share multiple edges between them. In this case, getEdges(Node other) can be used to obtain a complete list. -
getEdges
Description copied from interface:Node
Returns a collection of edges in the adjacency list of the node that are adjacent to another specified node. -
getEdgeArray
Returns the edge adjacency list of the node as an array.- Returns:
- An array containing edges adjacent to the node.
-
getEdges
Description copied from interface:Node
Returns the edge adjacency list of the node. -
setDegree
public void setDegree(int degree) Sets the degree of the node. This method build the edge adjacency array for the node.- Parameters:
degree
- The degree of the node / size of edge adjacency array.
-
getDegree
public int getDegree()Description copied from interface:Node
Returns the degree of the node. The degree of a node is defined as the number of edges that are adjacent to the node. -
getRelated
This iterator iterates over the underlying edge array of the node.- Specified by:
getRelated
in interfaceGraphable
- Returns:
- Iterator An iterator over other components of the graph that are related to the component.
- See Also:
-