Package org.geotools.graph.structure.opt
Class OptDirectedNode
Object
OptGraphable
OptDirectedNode
- All Implemented Interfaces:
Serializable,DirectedGraphable,DirectedNode,Graphable,Node
- Direct Known Subclasses:
OptDirectedXYNode
Optimized implementation of DirectedNode. The following optimizations reduce space and increase performance.
- In and Out edge adjacency list stored as arrays of exact size.
- Support from removing edges is removed
- The related component iterators iterates over the underlying edge arrays of the node instread of newly created collections.
- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassIterator used to iterate over related nodes. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new OptDirectedNode.OptDirectedNode(int indegree, int outdegree) Constructs a new OptDirectedNode. -
Method Summary
Modifier and TypeMethodDescriptionvoidNot supported.voidAdds an edge to the in adjacency list of the node.voidAdds an edge to the out adjacency list of the node.intReturns the degree of the node.Returns an edge in the adjacency list of the node that is adjacent to another specified node.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.intReturns the in degree of the node.getInEdge(DirectedNode other) Returns an edge that terminates at the node and originates from a specified node.Returns the in adjacency edge array of the node.Returns the in adjacency list of the node.getInEdges(DirectedNode other) Returns all edges that terminate at the node and originate from a specified node.This iterator iterates over the underlying in edge array of the node.intReturns the out degree of the node.getOutEdge(DirectedNode other) Returns an edge that originates at the node and terminates at a specified node.Returns the out adjacency edge array of the node.Returns the out adjacency list of the node.getOutEdges(DirectedNode other) Returns all edges that originate at the node and terminate from at specified node.This iterator iterates over the underlying out edge array of the node.This iterator iterates over the underlying edge arrays of the node.voidUnsupported Operation.voidUnsupported Operation.voidUnsupported Operation.voidsetInDegree(int indegree) Sets the in degree of the node.voidsetOutDegree(int outdegree) Sets the out degree of the node.Methods inherited from class OptGraphable
getCount, getID, getObject, isVisited, setCount, setID, setObject, setVisited
-
Constructor Details
-
OptDirectedNode
public OptDirectedNode()Constructs a new OptDirectedNode. This constructor does not create the edge adjacency arrays for the node. -
OptDirectedNode
public OptDirectedNode(int indegree, int outdegree) Constructs a new OptDirectedNode.- Parameters:
indegree- Number of in adjacenct edges to the node.outdegree- Number of out adjacent edges to the node.
-
-
Method Details
-
add
Not supported. -
addIn
Description copied from interface:DirectedNodeAdds an edge to the in adjacency list of the node.- Specified by:
addInin interfaceDirectedNode- Parameters:
e- A directed edge that terminates at the node.- See Also:
-
addOut
Description copied from interface:DirectedNodeAdds an edge to the out adjacency list of the node.- Specified by:
addOutin interfaceDirectedNode- Parameters:
e- A directed edge that originates from the node.- See Also:
-
remove
Unsupported Operation. -
removeIn
Unsupported Operation.- Specified by:
removeInin interfaceDirectedNode- Parameters:
e- A directed edge that terminates at the node.- See Also:
-
removeOut
Unsupported Operation.- Specified by:
removeOutin interfaceDirectedNode- Parameters:
e- A directed edge that originates from the node.- See Also:
-
getEdge
Description copied from interface:NodeReturns 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. -
getInEdge
Description copied from interface:DirectedNodeReturns an edge that terminates at the node and originates from a specified node.
Note: It is possible for two nodes to share multiple edges between them. In this case, getInEdges(Node other) can be used to obtain a complete list.- Specified by:
getInEdgein interfaceDirectedNode- Parameters:
other- The originating node.- Returns:
- The first edge found to terminate at the node and originate from the specefied node.
- See Also:
-
getOutEdge
Description copied from interface:DirectedNodeReturns an edge that originates at the node and terminates at a specified node.
Note: It is possible for two nodes to share multiple edges between them. In this case, getOutEdges(Node other) can be used to obtain a complete list.- Specified by:
getOutEdgein interfaceDirectedNode- Parameters:
other- The terminating node.- Returns:
- The first edge found to originate at the node and terminate at the specefied node.
- See Also:
-
getEdges
Description copied from interface:NodeReturns a collection of edges in the adjacency list of the node that are adjacent to another specified node. -
getInEdges
Description copied from interface:DirectedNodeReturns all edges that terminate at the node and originate from a specified node.- Specified by:
getInEdgesin interfaceDirectedNode- Parameters:
other- The originating node.- Returns:
- All edges found to terminate at the node and originate from the specified node.
- See Also:
-
getOutEdges
Description copied from interface:DirectedNodeReturns all edges that originate at the node and terminate from at specified node.- Specified by:
getOutEdgesin interfaceDirectedNode- Parameters:
other- The temimnating node.- Returns:
- All edges found to originate at the node and terminate at the specified node.
- See Also:
-
getEdges
Description copied from interface:NodeReturns the edge adjacency list of the node. -
getInEdgeArray
Returns the in adjacency edge array of the node.- Returns:
- An array of in edges for the node.
-
getInEdges
Description copied from interface:DirectedNodeReturns the in adjacency list of the node.- Specified by:
getInEdgesin interfaceDirectedNode- Returns:
- A list of edges that terminate at the node.
- See Also:
-
getOutEdgeArray
Returns the out adjacency edge array of the node.- Returns:
- An array of out edges for the node.
-
getOutEdges
Description copied from interface:DirectedNodeReturns the out adjacency list of the node.- Specified by:
getOutEdgesin interfaceDirectedNode- Returns:
- A list of edges originating at the node.
- See Also:
-
getDegree
public int getDegree()Description copied from interface:NodeReturns the degree of the node. The degree of a node is defined as the number of edges that are adjacent to the node. -
setInDegree
public void setInDegree(int indegree) Sets the in degree of the node. This method builds the in edge adjacency list of the node.- Parameters:
indegree- The in degree / size of in edge array of the node.
-
getInDegree
public int getInDegree()Description copied from interface:DirectedNodeReturns the in degree of the node.- Specified by:
getInDegreein interfaceDirectedNode- Returns:
- The number of edges that terminate at the node.
- See Also:
-
setOutDegree
public void setOutDegree(int outdegree) Sets the out degree of the node. This method builds the out edge adjacency list of the node.- Parameters:
outdegree- The out degree / size of out edge array of the node.
-
getOutDegree
public int getOutDegree()Description copied from interface:DirectedNodeReturns the out degree of the node.- Specified by:
getOutDegreein interfaceDirectedNode- Returns:
- The number of edges that originate at the node.
- See Also:
-
getRelated
This iterator iterates over the underlying edge arrays of the node.- Specified by:
getRelatedin interfaceGraphable- Returns:
- Iterator An iterator over other components of the graph that are related to the component.
- See Also:
-
getInRelated
This iterator iterates over the underlying in edge array of the node.- Specified by:
getInRelatedin interfaceDirectedGraphable- Returns:
- An iterator over the other directed components related through an in relationship.
- See Also:
-
getOutRelated
This iterator iterates over the underlying out edge array of the node.- Specified by:
getOutRelatedin interfaceDirectedGraphable- Returns:
- An iterator over the other directed components related through an out relationship.
- See Also:
-